diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index ccd5621505a..f212794e043 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -516,24 +516,10 @@ steps: concurrency: 1 concurrency_group: 'macos-e2e-tests' - - group: Windows Agents Setup - key: windows-setup - # Assumes Ruby 2.7 + resource kit is correctly installed on the target - # machine - steps: - - label: 💎 Configure Ruby - key: windows-ruby - commands: - - cd test\e2e - - bundle install - agents: - system: ${windows} - - group: Windows Artifacts key: windows-artifacts depends_on: - linux-nix - - windows-setup steps: - block: Build Windows Artifacts (windows) depends_on: [] @@ -544,6 +530,14 @@ steps: && build.env("RELEASE_CANDIDATE") == null key: trigger-build-windows-artifacts + - label: 💎 Configure Ruby + key: windows-ruby + commands: + - cd test\e2e + - bundle install + agents: + system: ${windows} + - label: Build Package (windows) key: windows-package depends_on: @@ -565,6 +559,7 @@ steps: - group: Windows Checks depends_on: - windows-artifacts + if: build.env("RELEASE_CANDIDATE") == null || build.env("TEST_RC") == "FALSE" steps: - label: Windows Unit Tests command: | @@ -587,7 +582,7 @@ steps: - block: Windows E2E Tests depends_on: [] - if: build.env("RELEASE_CANDIDATE") == null + if: build.env("RELEASE_CANDIDATE") == null || build.env("TEST_RC") == "TRUE" key: trigger-windows-e2e-tests - label: ⚙️ Windows E2E Tests @@ -630,21 +625,23 @@ steps: agents: system: x86_64-linux - - block: Docker Build - depends_on: [] - if: build.env("TEST_RC") == "TRUE" - key: docker-build-block - - - label: Push Docker Image - depends_on: - - docker-build - key: build-docker - command: - - "mkdir -p config && echo '{ outputs = _: { dockerHubRepoName = \"cardanofoundation/cardano-wallet\"; }; }' > config/flake.nix" - - "nix build .#pushDockerImage --override-input hostNixpkgs \"path:$(nix eval --impure -I $NIX_PATH --expr '(import {}).path')\" --override-input customConfig path:./config -o docker-build-push" - - "./docker-build-push" - agents: - system: x86_64-linux + + + # - block: Docker Build + # depends_on: [] + # if: build.env("TEST_RC") == "TRUE" + # key: docker-build-block + + # - label: Push Docker Image + # depends_on: + # - docker-build + # key: build-docker + # command: + # - "mkdir -p config && echo '{ outputs = _: { dockerHubRepoName = \"cardanofoundation/cardano-wallet\"; }; }' > config/flake.nix" + # - "nix build .#pushDockerImage --override-input hostNixpkgs \"path:$(nix eval --impure -I $NIX_PATH --expr '(import {}).path')\" --override-input customConfig path:./config -o docker-build-push" + # - "./docker-build-push" + # agents: + # system: x86_64-linux - group: Docker Checks depends_on: diff --git a/.buildkite/release.yml b/.buildkite/release.yml index 20f1f8ffd25..0e2ec2bb918 100644 --- a/.buildkite/release.yml +++ b/.buildkite/release.yml @@ -38,6 +38,7 @@ steps: key: nightly depends_on: main-pipeline-build steps: + - label: Push swagger nightly commands: - nix develop path:$RELEASE_SCRIPTS_DIR -c $RELEASE_SCRIPTS_DIR/push-to-bump.sh @@ -76,6 +77,28 @@ steps: env: RELEASE: false + - label: Push image to dockerhub + commands: + - nix develop path:$RELEASE_SCRIPTS_DIR -c $RELEASE_SCRIPTS_DIR/push-to-dockerhub.sh + agents: + system: x86_64-linux + env: + RELEASE: false + + + # - block: Push test image to dockerhub + # key: push-dockerhub + # depends_on: create-release + + # - label: Push test image to dockerhub + # depends_on: push-dockerhub + # commands: + # - nix develop path:$RELEASE_SCRIPTS_DIR -c $RELEASE_SCRIPTS_DIR/push-to-dockerhub.sh + # agents: + # system: x86_64-linux + # env: + # RELEASE: false + - group: Release depends_on: nightly if: build.branch == "master" @@ -123,17 +146,22 @@ steps: env: RELEASE: true - - label: Push Docker Image - depends_on: - - create-release - command: - - "mkdir -p config && echo '{ outputs = _: { dockerHubRepoName = \"cardanofoundation/cardano-wallet\"; }; }' > config/flake.nix" - - "nix build .#pushDockerImage --override-input hostNixpkgs \"path:$(nix eval --impure -I $NIX_PATH --expr '(import {}).path')\" --override-input customConfig path:./config -o docker-build-push" - - "./docker-build-push" - agents: - system: x86_64-linux - - label: Update Documentation Links depends_on: create-release commands: - nix develop path:$RELEASE_SCRIPTS_DIR -c $RELEASE_SCRIPTS_DIR/update-documentation-links.sh + + - block: Push to dockerhub + key: push-dockerhub + depends_on: create-release + + - label: Push to dockerhub + depends_on: push-dockerhub + artifact_paths: + - ./artifacts/*.tgz + commands: + - nix develop path:$RELEASE_SCRIPTS_DIR -c $RELEASE_SCRIPTS_DIR/push-to-dockerhub.sh + agents: + system: x86_64-linux + env: + RELEASE: true \ No newline at end of file diff --git a/scripts/buildkite/release/push-artifacts.sh b/scripts/buildkite/release/push-artifacts.sh index 048c98518f3..2335d31e814 100755 --- a/scripts/buildkite/release/push-artifacts.sh +++ b/scripts/buildkite/release/push-artifacts.sh @@ -4,9 +4,14 @@ set -euox pipefail base_build=$(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) if [ "$RELEASE" == "false" ]; then - TAG=nightly + if [ "$TEST_RC" == "TRUE" ]; then + TAG="test" + else + TAG="nightly" + fi else TAG=$NEW_GIT_TAG fi @@ -20,6 +25,7 @@ mkdir -p artifacts artifact() { local artifact_name=$1 + local new_artifact_name=$2 # 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" \ @@ -28,11 +34,12 @@ artifact() { curl -H "Authorization: Bearer $BUILDKITE_API_TOKEN" -L \ -o "artifacts/$artifact_name" \ "$artifact_value" - gh release upload "$TAG" "artifacts/$artifact_name" + mv "artifacts/$artifact_name" "artifacts/$new_artifact_name" + gh release upload "$TAG" "artifacts/$new_artifact_name" } -artifact "cardano-wallet-$NEW_GIT_TAG-linux64.tar.gz" -artifact "cardano-wallet.exe-$NEW_GIT_TAG-win64.zip" -artifact "cardano-wallet-$NEW_GIT_TAG-macos-silicon.tar.gz" -artifact "cardano-wallet-$NEW_GIT_TAG-macos-intel.tar.gz" -artifact "cardano-wallet-$NEW_GIT_TAG-docker-image.tgz" +artifact "cardano-wallet-$NEW_GIT_TAG-linux64.tar.gz" "cardano-wallet-$TAG-linux64.tar.gz" +artifact "cardano-wallet.exe-$NEW_GIT_TAG-win64.zip" "cardano-wallet.exe-$TAG-win64.zip" +artifact "cardano-wallet-$NEW_GIT_TAG-macos-silicon.tar.gz" "cardano-wallet-$TAG-macos-silicon.tar.gz" +artifact "cardano-wallet-$NEW_GIT_TAG-macos-intel.tar.gz" "cardano-wallet-$TAG-macos-intel.tar.gz" +artifact "cardano-wallet-$NEW_GIT_TAG-docker-image.tgz" "cardano-wallet-$TAG-docker-image.tgz" diff --git a/scripts/buildkite/release/push-release.sh b/scripts/buildkite/release/push-release.sh index e621820edd4..1ef18b8413a 100755 --- a/scripts/buildkite/release/push-release.sh +++ b/scripts/buildkite/release/push-release.sh @@ -3,10 +3,17 @@ set -euox pipefail NEW_GIT_TAG=$(buildkite-agent meta-data get release-version) +TEST_RC=$(buildkite-agent meta-data get test-rc) if [ "$RELEASE" == "false" ]; then - TAG=nightly - title="Nightly $NEW_GIT_TAG" + if [ "$TEST_RC" == "FALSE" ]; then + TAG=nightly + title="Nightly $NEW_GIT_TAG" + else + TAG="test" + title="Test $NEW_GIT_TAG" + fi + else TAG=$NEW_GIT_TAG title="Release $TAG" diff --git a/scripts/buildkite/release/push-tag.sh b/scripts/buildkite/release/push-tag.sh index 73dac42a7f6..64b26070d4a 100755 --- a/scripts/buildkite/release/push-tag.sh +++ b/scripts/buildkite/release/push-tag.sh @@ -3,13 +3,19 @@ set -euox pipefail RELEASE_GIT_COMMIT=$(buildkite-agent meta-data get release-candidate-commit) +TEST_RC=$(buildkite-agent meta-data get test-rc) git tag -l | xargs git tag -d git fetch --tags if [ "$RELEASE" == "false" ]; then - git tag -d nightly || true - TAG=nightly + if [ "$TEST_RC" == "TRUE" ]; then + git tag -d nightly || true + TAG=nightly + else + git tag -d test || true + TAG="test" + fi else TAG=$(buildkite-agent meta-data get release-version) exists=$(git tag -l "$TAG") diff --git a/scripts/buildkite/release/push-to-bump.sh b/scripts/buildkite/release/push-to-bump.sh index c18f31b2959..16e9b853320 100755 --- a/scripts/buildkite/release/push-to-bump.sh +++ b/scripts/buildkite/release/push-to-bump.sh @@ -2,6 +2,7 @@ set -euox pipefail +TEST_RC=$(buildkite-agent meta-data get test-rc --default "FALSE") if [[ -n "${BUILDKITE-}" ]]; then RELEASE_CANDIDATE_COMMIT=$(buildkite-agent meta-data get release-candidate-commit --default "") @@ -12,7 +13,6 @@ else RELEASE_CANDIDATE_COMMIT="" fi - npm install bump-cli@2.8.4 export PATH=$PWD/node_modules/.bin:$PATH @@ -25,8 +25,13 @@ if [[ "$RELEASE" == "true" ]]; then TOKEN="$BUMP_RELEASE_TOKEN" REPO=cardano-wallet-backend else - TOKEN="$BUMP_DAILY_TOKEN" - REPO=cardano-wallet-backend-daily + if [[ "$TEST_RC" == "TRUE" ]]; then + TOKEN="$BUMP_TEST_TOKEN" + REPO=cardano-wallet-backend-test + else + TOKEN="$BUMP_DAILY_TOKEN" + REPO=cardano-wallet-backend-daily + fi fi bump diff \ diff --git a/scripts/buildkite/release/push-to-dockerhub.sh b/scripts/buildkite/release/push-to-dockerhub.sh new file mode 100755 index 00000000000..5fa2fbcee99 --- /dev/null +++ b/scripts/buildkite/release/push-to-dockerhub.sh @@ -0,0 +1,43 @@ +#!/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) + +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 + +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" + local image_name="cardanofoundation/cardano-wallet:$TAG" + docker login -u cfhal -p "$DOCKER_HUB_TOKEN" + docker load -i "artifacts/$artifact_name" + # docker push "$image_name" + echo "$image_name" +} + +artifact "cardano-wallet-$NEW_GIT_TAG-docker-image.tgz" \ No newline at end of file diff --git a/scripts/buildkite/release/release-candidate.sh b/scripts/buildkite/release/release-candidate.sh index c52d5bf26ba..b1dda3e2c72 100755 --- a/scripts/buildkite/release/release-candidate.sh +++ b/scripts/buildkite/release/release-candidate.sh @@ -3,17 +3,29 @@ set -euox pipefail +if [ "$BUILDKITE_BRANCH" == "master" ]; then + TEST_RC="FALSE" +else + TEST_RC="TRUE" +fi + # date from git tag # example v2023-04-04 -> 2023-04-04 tag_date() { echo "${1##v}" } + +tag_today() { + sed -e 's/-0/-/g' -e 's/-/./g' <<< "$1" +} + # cabal version from git tag # example v2023-04-04 -> 2023.4.4 tag_cabal_ver() { - tag_date "$1" | sed -e s/-0/-/g -e s/-/./g + tag_today "$(tag_date "$1")" } + git tag -l | xargs git tag -d git fetch --tags @@ -23,9 +35,8 @@ git checkout "$BASE_COMMIT" today=$(date +%Y-%m-%d) -NEW_GIT_TAG=v$today - -NEW_CABAL_VERSION=$(tag_cabal_ver "$NEW_GIT_TAG") +NEW_GIT_TAG="v$today" +NEW_CABAL_VERSION=$(tag_today "$today") OLD_GIT_TAG=$( git tag -l "v2*-*-*" | sort | tail -n1) @@ -47,10 +58,8 @@ CARDANO_NODE_TAG=$(cardano-node version | head -n1 | awk '{print $2}') if [ "$BUILDKITE_BRANCH" == "master" ]; then RELEASE_CANDIDATE_BRANCH="release-candidate/$NEW_GIT_TAG" - TEST_RC="FALSE" else RELEASE_CANDIDATE_BRANCH="test-rc/$BUILDKITE_BRANCH" - TEST_RC="TRUE" fi git config --global user.email "gha@cardanofoundation.org"