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:
- test
- build
- integration
- release-build
- release-upload
- release-publish
- release
# 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?
# 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
# Docker cache volumes look like this runner-<short-token>-project-<id>-concurrent-<concurrency-id>-cache-<md5-of-path>
cache:
......@@ -110,34 +108,38 @@ integration-docker:
script:
- ./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:
stage: release-build
needs: [build]
only:
- tags
stage: release
needs: [build,integration-general,integration-docker]
cache: {}
#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
image: addshore/wm-golang-curl:1.13-3
# artifacts:
# paths:
# - _release/
image: docker-registry.wikimedia.org/golang:1.13-3
artifacts:
paths:
- _release/
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}
# 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:
only:
- tags
stage: release-upload
needs: [integration-general, integration-docker, release-build]
stage: release
needs: [release-build]
dependencies:
- release-build
# Has 1 requirement of curl, could be replaced by a wmf releng image?
......@@ -147,28 +149,26 @@ release-upload:
# https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-generic-package-by-using-cicd
script:
- 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
# 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
- >
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
release-publish:
only:
- tags
stage: release-publish
needs: [release-build, release-upload]
stage: release
needs: [release-upload,release-build]
dependencies:
- release-build
image: registry.gitlab.com/gitlab-org/release-cli:latest
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
- 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
release_file="mw_${CI_COMMIT_TAG}_$release_suffix"
for release_path in $(find ./_release -type f); do
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}\"}"
done
- 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