Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/GitHub actions - update release workflow to verify release was successful #779

Merged
merged 6 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/scripts/verify-docker-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash

#############################################################################################################################################################################################
## Description: The script helps in verifying two things:- ##
## (1) All the images that are passed as parameters are pushed successfully to dockerhub. This is done by fetching the SHA Digests ##
## for all the images. If we are able to fetch the SHA Digest for the images, that means the images are available at Dockerhub ##
## ##
## (2) All the images that are passed as parameters are same or not. This is done by matching the SHA Digests for all the images. ##
## If the SHA Digest for all the images are same, that means the images are same. ##
## ##
## NOTE: I have used "Skopeo" to inspect the images. Skopeo tool can helps us in inspecting the docker images without pulling them ##
## ##
## USAGE: The script accepts image names as paramaters. We can pass as many image names as we want. ##
## ##
## EXAMPLE: ./verify-docker-release.sh apicurio/apicurio-registry-infinispan:1.2.3.Final apicurio/apicurio-registry-infinispan:latest apicurio/apicurio-registry-infinispan:latest-release ##
## ##
#############################################################################################################################################################################################

set -euo pipefail

IMAGES=("$@")
SHA=()
i=0

# Fetching SHA Digest for the images
for image in "${IMAGES[@]}"; do
SHA[$i]=$(skopeo inspect --raw --tls-verify=false docker://${image} | jq --raw-output '.config.digest' | sed 's/sha256://;s/"//g')
echo "SHA for Image ${image}: ${SHA[$i]}"
((i=i+1))
done
echo "The Images are successfully pushed to the dockerhub. Verifying if the images are same..."


# Verifying if images are same by comparing SHA Digest of the images
watermark=${SHA[0]}
not_equal=false
for i in "${SHA[@]}"; do
if [[ "$watermark" != "$i" ]]; then
not_equal=true
break
fi
done

if [[ $not_equal = "true" ]]; then
echo "[FAILURE] The Images Are Not Same. Verification Failed" && exit 1
else
echo "[SUCCESS] Verification Successfull! The SHA Digest Matched for all the images."
fi




31 changes: 31 additions & 0 deletions .github/test-mvn-deploy/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.apicurio.test</groupId>
<artifactId>verify-registry-maven-deploy</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>verify-registry-maven-deploy</name>
<description>Simple Project to verify the deployment of Apicurio Registry JARS</description>

<properties>
<!-- To be filled at runtime using "-Dversion.apicurio=1.x.x.Final" -->
<version.apicurio>TBD</version.apicurio>
</properties>

<dependencies>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-utils-serde</artifactId>
<version>${version.apicurio}</version>
</dependency>
<dependency>
<groupId>io.apicurio</groupId>
<artifactId>apicurio-registry-rest-client</artifactId>
<version>${version.apicurio}</version>
</dependency>
</dependencies>
</project>


35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,38 @@ jobs:
git add -f _data/registry/releases/$FILENAME.json #ignored due to .gitignore config
git commit -m "Automated Update For Apicurio Registry Release Version: ${{steps.metadata.outputs.release-version}}"
git push

verify-release:
runs-on: ubuntu-18.04
needs: ["release"] # The Job gets triggered only after the "release" job has successfully completed. The job doesn't run in case the "release" job fails
EricWittmann marked this conversation as resolved.
Show resolved Hide resolved
if: github.event.pull_request.merged == true && github.repository_owner == 'Apicurio'
steps:
- name: Retrieve Project Metadata
uses: radcortez/project-metadata-action@master
id: metadata
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yaml'
- name: Set up JDK 1.8
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '8'
architecture: x64
- name: Checkout Code
uses: actions/checkout@v2
- name: Verify Docker Release For mem
run: ./.github/scripts/verify-docker-release.sh apicurio/apicurio-registry-mem:${{steps.metadata.outputs.release-version}} apicurio/apicurio-registry-mem:latest apicurio/apicurio-registry-mem:latest-release
- name: Verify Docker Release For asyncmem
run: ./.github/scripts/verify-docker-release.sh apicurio/apicurio-registry-asyncmem:${{steps.metadata.outputs.release-version}} apicurio/apicurio-registry-asyncmem:latest apicurio/apicurio-registry-asyncmem:latest-release
- name: Verify Docker Release For kafka
run: ./.github/scripts/verify-docker-release.sh apicurio/apicurio-registry-kafka:${{steps.metadata.outputs.release-version}} apicurio/apicurio-registry-kafka:latest apicurio/apicurio-registry-kafka:latest-release
- name: Verify Docker Release For streams
run: ./.github/scripts/verify-docker-release.sh apicurio/apicurio-registry-streams:${{steps.metadata.outputs.release-version}} apicurio/apicurio-registry-streams:latest apicurio/apicurio-registry-streams:latest-release
- name: Verify Docker Release For jpa
run: ./.github/scripts/verify-docker-release.sh apicurio/apicurio-registry-jpa:${{steps.metadata.outputs.release-version}} apicurio/apicurio-registry-jpa:latest apicurio/apicurio-registry-jpa:latest-release
- name: Verify Docker Release For infinispan
run: ./.github/scripts/verify-docker-release.sh apicurio/apicurio-registry-infinispan:${{steps.metadata.outputs.release-version}} apicurio/apicurio-registry-infinispan:latest apicurio/apicurio-registry-infinispan:latest-release
- name: Verify Maven Release
run: |
cd .github/test-mvn-deploy
mvn clean install "-Dversion.apicurio=${{steps.metadata.outputs.release-version}}" # Passing the latest version at run-time