Skip to content

Commit

Permalink
Changes to release workflow
Browse files Browse the repository at this point in the history
Workflow environment variable changed to RELEASE_VERSION instead of RELEASE_NAME to make it more meaningful

Workflows draft-release and docker-promote previously trigger workflow container-verify. This can result in trigger is successful but actual verificaition workflow fails. This will not be reflected in the draft-release and docker-promote workflows. Container verify code is embedded in the draft-release and docker-promote workflows to avoid this confusion

Signed-off-by: Chaminda Divitotawela <[email protected]>
  • Loading branch information
cdivitotawela committed Oct 2, 2024
1 parent 49bf37c commit 150ce44
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 86 deletions.
61 changes: 43 additions & 18 deletions .github/workflows/docker-promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ jobs:
validate:
runs-on: ubuntu-22.04
env:
RELEASE_NAME: "${{ github.event.release.name }}"
RELEASE_VERSION: "${{ github.event.release.name }}"
steps:
- name: Pre-process Release Name
id: pre_process_release_name
id: pre_process_release_version
run: |
# strip all whitespace
RELEASE_NAME="${RELEASE_NAME//[[:space:]]/}"
if [[ ! "$RELEASE_NAME" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-.*)?$ ]]; then
RELEASE_VERSION="${RELEASE_VERSION//[[:space:]]/}"
if [[ ! "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+(\.[0-9]+)?(-.*)?$ ]]; then
echo "Release name does not conform to a valid besu release format YY.M.v[-suffix], e.g. 24.8.0-RC1."
exit 1
fi
echo "release_name=$RELEASE_NAME" >> $GITHUB_OUTPUT # Set as output using the new syntax
echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT # Set as output using the new syntax
outputs:
release_name: ${{ steps.pre_process_release_name.outputs.release_name }}
release_version: ${{ steps.pre_process_release_version.outputs.release_version }}

docker-promote:
needs: [validate]
env:
RELEASE_NAME: ${{ needs.validate.outputs.release_name }} # Use the output from the pre_process_release job
RELEASE_VERSION: ${{ needs.validate.outputs.release_version }}
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand All @@ -58,24 +58,49 @@ jobs:
cache-disabled: true

- name: Docker upload
run: ./gradlew "-Prelease.releaseVersion=${{ env.RELEASE_NAME }}" "-PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }}" dockerUploadRelease
run: ./gradlew "-Prelease.releaseVersion=${{ env.RELEASE_VERSION }}" "-PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }}" dockerUploadRelease

- name: Docker manifest
run: ./gradlew "-Prelease.releaseVersion=${{ env.RELEASE_NAME }}" "-PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }}" manifestDockerRelease
run: ./gradlew "-Prelease.releaseVersion=${{ env.RELEASE_VERSION }}" "-PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }}" manifestDockerRelease

docker-verify:
needs: [validate, docker-promote]
needs: [validate,docker-promote]
env:
RELEASE_NAME: ${{ needs.validate.outputs.release_name }} # Use the output from the pre_process_release job
runs-on: ubuntu-22.04
permissions:
contents: read
actions: write
CONTAINER_NAME: besu-check
RELEASE_VERSION: ${{ needs.validate.outputs.release_version }}
runs-on: ${{ matrix.combination.runner }}
timeout-minutes: 4
strategy:
matrix:
combination:
- tag: ${{ needs.validate.outputs.release_version }}
platform: ''
runner: ubuntu-22.04
- tag: ${{ needs.validate.outputs.release_version }}-amd64
platform: 'linux/amd64'
runner: ubuntu-22.04
- tag: latest
platform: ''
runner: ubuntu-22.04
- tag: ${{ needs.validate.outputs.release_version }}-arm64
platform: ''
runner: besu-arm64
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: Trigger container verify
run: echo '{"version":"${{ env.RELEASE_NAME }}","verify-latest-version":"true"}' | gh workflow run container-verify.yml --json
- name: Start container
run: |
PLATFORM_OPT=""
[[ x${{ matrix.combination.platform }} != 'x' ]] && PLATFORM_OPT="--platform ${{ matrix.combination.platform }}"
docker run -d $PLATFORM_OPT --name ${{ env.CONTAINER_NAME }} ${{ secrets.DOCKER_ORG }}/besu:${{ matrix.combination.tag }}
- name: Verify besu container
run: bash .github/workflows/BesuContainerVerify.sh
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ matrix.combination.tag }}
VERSION: ${{ env.RELEASE_VERSION }}
CHECK_LATEST: true

- name: Stop container
run: docker stop ${{ env.CONTAINER_NAME }}
Loading

0 comments on commit 150ce44

Please sign in to comment.