-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Changes - [x] Move the push to dockerhub step from the main pipeline to the release one in the nightly group - [x] Use a bash script that collect the image from the artifacts to push to dockerhub and respect `test` and `nightly` tags - [x] Ditch the nix solution to push to dockerhub - [x] Add a block before pushing the release tag to dockerhub ### Issues fix #4900
- Loading branch information
Showing
5 changed files
with
91 additions
and
140 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euox pipefail | ||
|
||
TRIGGERED_BY=$(buildkite-agent meta-data get base-build) | ||
NEW_GIT_TAG=$(buildkite-agent meta-data get release-version) | ||
TEST_RC=$(buildkite-agent meta-data get test-rc) | ||
CABAL_VERSION=$(buildkite-agent meta-data get release-cabal-version) | ||
|
||
if [ "$RELEASE" == "false" ]; then | ||
if [ "$TEST_RC" == "TRUE" ]; then | ||
TAG="test" | ||
else | ||
TAG="nightly" | ||
fi | ||
else | ||
TAG=$NEW_GIT_TAG | ||
fi | ||
|
||
main_build=$(curl -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \ | ||
-X GET "https://api.buildkite.com/v2/builds" \ | ||
| jq ".[] | select(.meta_data.\"triggered-by\" == \"$TRIGGERED_BY\")" \ | ||
| jq .number) | ||
|
||
mkdir -p artifacts | ||
|
||
repo="cardanofoundation/cardano-wallet" | ||
|
||
artifact() { | ||
local artifact_name=$1 | ||
# shellcheck disable=SC2155 | ||
local artifact_value=$(curl -H "Authorization: Bearer $BUILDKITE_API_TOKEN" \ | ||
-X GET "https://api.buildkite.com/v2/organizations/cardano-foundation/pipelines/cardano-wallet/builds/$main_build/artifacts?per_page=100" \ | ||
| jq -r " [.[] | select(.filename == \"$artifact_name\")][0] \ | ||
| .download_url") | ||
curl -H "Authorization: Bearer $BUILDKITE_API_TOKEN" -L \ | ||
-o "artifacts/$artifact_name" \ | ||
"$artifact_value" | ||
docker login -u cfhal -p "$DOCKER_HUB_TOKEN" | ||
docker load -i "artifacts/$artifact_name" | ||
local image_name="$repo:$TAG" | ||
if [ "$RELEASE" == "false" ]; then | ||
local loaded_image_name="$repo:$CABAL_VERSION" | ||
docker tag "$loaded_image_name" "$image_name" | ||
docker push "$image_name" | ||
else | ||
local latest_image_name="$repo:latest" | ||
docker push "$image_name" | ||
docker tag "$image_name" "$latest_image_name" | ||
docker push "$latest_image_name" | ||
fi | ||
} | ||
|
||
artifact "cardano-wallet-$NEW_GIT_TAG-docker-image.tgz" |