From 6ebb9de47309956e799151e306d76a7f533185d6 Mon Sep 17 00:00:00 2001 From: garyschulte Date: Fri, 5 Apr 2024 15:23:04 -0700 Subject: [PATCH] initial develop publishing Signed-off-by: garyschulte --- .github/workflows/develop.yml | 128 ++++++++++++++++++++++++++++++++++ build.gradle | 3 +- 2 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/develop.yml diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml new file mode 100644 index 00000000000..5045eed13eb --- /dev/null +++ b/.github/workflows/develop.yml @@ -0,0 +1,128 @@ +name: docker develop + +on: + push: + branches: + - main +env: + registry: docker.io + +jobs: + hadolint: + runs-on: ubuntu-22.04 + steps: + - name: Checkout Repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 17 + - name: setup gradle + uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 + with: + cache-disabled: true + - name: hadoLint_openj9-jdk_17 + run: docker run --rm -i hadolint/hadolint < docker/openj9-jdk-17/Dockerfile + - name: hadoLint_openjdk_17 + run: docker run --rm -i hadolint/hadolint < docker/openjdk-17/Dockerfile + - name: hadoLint_openjdk_17_debug + run: docker run --rm -i hadolint/hadolint < docker/openjdk-17-debug/Dockerfile + - name: hadoLint_openjdk_latest + run: docker run --rm -i hadolint/hadolint < docker/openjdk-latest/Dockerfile + - name: hadoLint_graalvm + run: docker run --rm -i hadolint/hadolint < docker/graalvm/Dockerfile + buildDocker: + needs: hadolint + permissions: + contents: read + packages: write + + strategy: + fail-fast: false + matrix: + platform: + - ubuntu-22.04 + - [self-hosted, ARM64] + runs-on: ${{ matrix.platform }} + steps: + - name: Prepare + id: prep + run: | + platform=${{ matrix.platform }} + if [ "$platform" = 'ubuntu-22.04' ]; then + echo "PLATFORM_PAIR=linux-amd64" >> $GITHUB_OUTPUT + echo "ARCH=amd64" >> $GITHUB_OUTPUT + else + echo "PLATFORM_PAIR=linux-arm64" >> $GITHUB_OUTPUT + echo "ARCH=arm64" >> $GITHUB_OUTPUT + fi + + # Get the current date and time in the format YY.MM + DATE_TIME=$(date +"%y.%m") + # Get the short SHA of the merge commit + SHORT_SHA=${GITHUB_SHA::7} + # Construct the build target name + BUILD_TARGET_NAME="${DATE_TIME}-develop-${SHORT_SHA}" + echo "Build Target Name: $BUILD_TARGET_NAME" + # Set the build target name as an environment variable + echo "BUILD_TARGET_NAME=${BUILD_TARGET_NAME}" >> $GITHUB_ENV + + - name: Checkout Repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 17 + - name: setup gradle + uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 + with: + cache-disabled: true + - name: install goss + run: | + mkdir -p docker/reports + curl -L https://github.com/aelsabbahy/goss/releases/download/v0.4.4/goss-${{ steps.prep.outputs.PLATFORM_PAIR }} -o ./docker/tests/goss-${{ steps.prep.outputs.PLATFORM_PAIR }} + - name: login to ${{ env.registry }} + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d + with: + registry: ${{ env.registry }} + username: ${{ secrets.DOCKER_USER_RW }} + password: ${{ secrets.DOCKER_PASSWORD_RW }} + - name: build and test docker + uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 + env: + architecture: ${{ steps.prep.outputs.ARCH }} + with: + cache-disabled: true + arguments: testDocker -PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }} -Pversion=${{ env.BUILD_TARGET_NAME}} -Prelease.releaseVersion=develop + - name: publish + env: + architecture: ${{ steps.prep.outputs.ARCH }} + run: ./gradlew --no-daemon dockerUpload -PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }} -Pversion=${{ env.BUILD_TARGET_NAME }} -Prelease.releaseVersion=develop + multiArch: + needs: buildDocker + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + steps: + - name: Checkout Repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Set up Java + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 + with: + distribution: temurin + java-version: 17 + - name: setup gradle + uses: gradle/actions/setup-gradle@9e899d11ad247ec76be7a60bc1cf9d3abbb9e7f1 + with: + cache-disabled: true + - name: login to ${{ env.registry }} + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d + with: + registry: ${{ env.registry }} + username: ${{ secrets.DOCKER_USER_RW }} + password: ${{ secrets.DOCKER_PASSWORD_RW }} + - name: multi-arch docker + run: ./gradlew manifestDocker -PdockerOrgName=${{ env.registry }}/${{ secrets.DOCKER_ORG }} -Pversion=${{ env.BUILD_TARGET_NAME }} -Prelease.releaseVersion=develop diff --git a/build.gradle b/build.gradle index f4493ddb6e2..0546ed08b12 100644 --- a/build.gradle +++ b/build.gradle @@ -1060,7 +1060,8 @@ def getGitCommitDetails(length = 8) { // Takes the version and if it contains SNAPSHOT, alpha, beta or RC in version then return true indicating an interim build def isInterimBuild(dockerBuildVersion) { return (dockerBuildVersion ==~ /.*-SNAPSHOT/) || (dockerBuildVersion ==~ /.*-alpha/) - || (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/) + || (dockerBuildVersion ==~ /.*-beta/) || (dockerBuildVersion ==~ /.*-RC.*/ + || (dockerBuildVersion ==~ /.*-develop.*/) } tasks.register("verifyDistributions") {