Commit 44d74c2d authored by Addshore's avatar Addshore 🏄
Browse files

Use artifacts as part of the release process once more!

Bug: T292372
parent 0363ce99
...@@ -21,13 +21,11 @@ stages: ...@@ -21,13 +21,11 @@ stages:
- test - test
- build - build
- integration - integration
- release-build - release
- release-upload
- release-publish
# The plan would be for this cache to be reused by all jobs. # The plan would be for this cache to be reused by all jobs.
# Caches currently end up cached per runner, per job concurrency level and per md5 of path? # Caches currently end up cached per runner, per job concurrency level and per md5 of path?
# So there are potentially 12 caches that end up needing to be populated right now? # So there are lots of duplicate caches that end up needing to be populated right now?
# https://forum.gitlab.com/t/confusion-around-ci-docker-cache-volumes-and-sharing-across-jobs-concurrency/56793 # https://forum.gitlab.com/t/confusion-around-ci-docker-cache-volumes-and-sharing-across-jobs-concurrency/56793
# Docker cache volumes look like this runner-<short-token>-project-<id>-concurrent-<concurrency-id>-cache-<md5-of-path> # Docker cache volumes look like this runner-<short-token>-project-<id>-concurrent-<concurrency-id>-cache-<md5-of-path>
cache: cache:
...@@ -110,34 +108,38 @@ integration-docker: ...@@ -110,34 +108,38 @@ integration-docker:
script: script:
- ./tests/$TEST - ./tests/$TEST
build-release:
except:
- tags
stage: release
needs: [build,integration-general,integration-docker]
cache: {}
image: docker-registry.wikimedia.org/golang:1.13-3
script:
# Ideally make would not be needed, only release? But it is needed to install deps currently?
- make
- make release VERSION=${CI_COMMIT_TAG:-$CI_COMMIT_BRANCH}
release-build: release-build:
stage: release-build only:
needs: [build] - tags
stage: release
needs: [build,integration-general,integration-docker]
cache: {} cache: {}
#image: docker-registry.wikimedia.org/golang:1.13-3 image: docker-registry.wikimedia.org/golang:1.13-3
# Custom 1.13 image that also has curl in, which is needed for the release upload hack https://phabricator.wikimedia.org/T292372 artifacts:
image: addshore/wm-golang-curl:1.13-3 paths:
# artifacts: - _release/
# paths:
# - _release/
script: script:
# Ideally make would not be needed, only release? But it is needed to install deps currently? # Ideally make would not be needed, only release? But it is needed to install deps currently?
- make - make
- make release VERSION=${CI_COMMIT_TAG:-$CI_COMMIT_BRANCH} - make release VERSION=${CI_COMMIT_TAG:-$CI_COMMIT_BRANCH}
# This next part should be in release-upload, but https://phabricator.wikimedia.org/T292372
- >
if [ -n "$CI_COMMIT_TAG" ]; then
for release_path in $(find ./_release -type f); do
release_file=$(echo $release_path | sed "s/.*\///")
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${release_path} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mwcli/${CI_COMMIT_TAG}/${release_file}"
done
fi
release-upload: release-upload:
only: only:
- tags - tags
stage: release-upload stage: release
needs: [integration-general, integration-docker, release-build] needs: [release-build]
dependencies: dependencies:
- release-build - release-build
# Has 1 requirement of curl, could be replaced by a wmf releng image? # Has 1 requirement of curl, could be replaced by a wmf releng image?
...@@ -147,28 +149,26 @@ release-upload: ...@@ -147,28 +149,26 @@ release-upload:
# https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-generic-package-by-using-cicd # https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-generic-package-by-using-cicd
script: script:
- echo "Placeholder job, as a conditional upload currently happens as part of release-build awaiting decision on https://phabricator.wikimedia.org/T292372" - echo "Placeholder job, as a conditional upload currently happens as part of release-build awaiting decision on https://phabricator.wikimedia.org/T292372"
# - > - >
# for release_path in $(find ./_release -type f); do for release_path in $(find ./_release -type f); do
# release_file=$(echo $release_path | sed "s/.*\///") release_file=$(echo $release_path | sed "s/.*\///")
# curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${release_path} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mwcli/${CI_COMMIT_TAG}/${release_file}" curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${release_path} "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mwcli/${CI_COMMIT_TAG}/${release_file}"
# done done
release-publish: release-publish:
only: only:
- tags - tags
stage: release-publish stage: release
needs: [release-build, release-upload] needs: [release-upload,release-build]
dependencies: dependencies:
- release-build - release-build
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
script: script:
- (echo "## ${CI_COMMIT_TAG}" && echo "CHANGELOG extracted from https://gitlab.wikimedia.org/releng/cli/-/blob/main/CHANGELOG.md" && sed "/^## ${CI_COMMIT_TAG}$/,/^## /"'!d'";//d;/\^$/d" CHANGELOG.md) > .gitlab.description.md - (echo "## ${CI_COMMIT_TAG}" && echo "CHANGELOG extracted from https://gitlab.wikimedia.org/releng/cli/-/blob/main/CHANGELOG.md" && sed "/^## ${CI_COMMIT_TAG}$/,/^## /"'!d'";//d;/\^$/d" CHANGELOG.md) > .gitlab.description.md
- assets_links="" - assets_links=""
# Manually maintained list of files to upload to release, until https://phabricator.wikimedia.org/T292372 is changed
# This used to just list the files that were in a directory!
- > - >
for release_suffix in linux_arm.sha256 windows_amd64.exe linux_amd64.sha256 linux_386 darwin_amd64.sha256 darwin_amd64 linux_amd64 windows_amd64.exe.sha256 linux_386.sha256 linux_ppc64le linux_arm64 linux_arm linux_ppc64le.sha256 linux_arm64.sha256; do for release_path in $(find ./_release -type f); do
release_file="mw_${CI_COMMIT_TAG}_$release_suffix" release_file=$(echo $release_path | sed "s/.*\///")
assets_links="${assets_links} --assets-link {\"name\":\"${release_file}\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mwcli/${CI_COMMIT_TAG}/${release_file}\"}" assets_links="${assets_links} --assets-link {\"name\":\"${release_file}\",\"url\":\"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/mwcli/${CI_COMMIT_TAG}/${release_file}\"}"
done done
- release-cli create --name "Release $CI_COMMIT_TAG" --description ".gitlab.description.md" --released-at "${CI_COMMIT_TIMESTAMP}" ${assets_links} - release-cli create --name "Release $CI_COMMIT_TAG" --description ".gitlab.description.md" --released-at "${CI_COMMIT_TIMESTAMP}" ${assets_links}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment