Update Container Images to GL 1877 #570
Workflow file for this run
This file contains hidden or 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
| name: Java CI with Gradle | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| # This is required for requesting the JWT | |
| id-token: write | |
| # Push container images | |
| packages: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| java-version: '25' | |
| distribution: 'sapmachine' | |
| # Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. | |
| # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5 | |
| - name: Start container with postgres for testing | |
| run: docker compose --file unit-test-db-compose.yaml up --build --wait --detach | |
| - name: Build with Gradle Wrapper | |
| run: ./gradlew --no-daemon build asciidoctor | |
| - name: Store reports | |
| if: failure() | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: reports | |
| path: | | |
| **/build/reports/ | |
| **/build/test-results/ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: build-artifacts | |
| path: 'build' | |
| container-image: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - build | |
| env: | |
| # Change this if you fork the repo | |
| IMAGE_NAME_ORG: gardenlinux | |
| # Change this if you fork the repo | |
| OIDC_AUDIENCE: glvd | |
| IMAGE_NAME: glvd-api | |
| IMAGE_TAG: latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - run: mkdir -p build | |
| - name: Download built jar | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: build-artifacts | |
| path: build | |
| - name: Install qemu dependency for multi-arch build | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y qemu-user-static | |
| - name: Build Image | |
| id: build_image | |
| uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2.13 | |
| with: | |
| image: ${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }} | |
| tags: ${{ env.IMAGE_TAG }} | |
| platforms: linux/amd64, linux/arm64 | |
| containerfiles: | | |
| ./Containerfile | |
| - name: Echo Outputs | |
| run: | | |
| echo "Image: ${{ steps.build_image.outputs.image }}" | |
| echo "Tags: ${{ steps.build_image.outputs.tags }}" | |
| echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}" | |
| - name: Check images created | |
| run: buildah images | grep '${{ env.IMAGE_NAME }}' | |
| - name: Check manifest | |
| run: | | |
| set -x | |
| buildah manifest inspect ${{ steps.build_image.outputs.image }}:${{ env.IMAGE_TAG }} | |
| - name: Push To ghcr.io | |
| id: push-to-ghcr | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8 | |
| with: | |
| image: ${{ steps.build_image.outputs.image }} | |
| tags: ${{ steps.build_image.outputs.tags }} | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Log in to ghcr.io | |
| uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7 | |
| with: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| - name: Build bare images | |
| run: | | |
| ./build_bare.sh ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }} latest | |
| - name: Push bare images | |
| if: ${{ github.event_name != 'pull_request' }} | |
| id: bare | |
| run: | | |
| podman push --digestfile=bare-amd64-digest ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}:latest-linuxamd64_bare | |
| podman push ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}:latest-linuxarm64_bare | |
| echo "bare-amd64-digest=$(cat ./bare-amd64-digest)" >> $GITHUB_OUTPUT | |
| - name: Print image url | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: echo "Image pushed to ${{ steps.push-to-ghcr.outputs.registry-paths }}" | |
| - name: Print digest | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: echo "Image pushed to ${{ steps.push-to-ghcr.outputs.digest }}" | |
| - name: Authenticate to cluster | |
| id: kube_auth | |
| uses: gardener/cc-utils/.github/actions/kubernetes-auth@8ec69f5cd2e1a2cae55709af1d9703a801893dfa # ocm/0.1.0 | |
| with: | |
| server: https://api.dev.gl-dev.shoot.canary.k8s-hana.ondemand.com | |
| server-ca-discovery-url: https://discovery.ingress.garden.canary.k8s.ondemand.com/projects/gl-dev/shoots/6a3efe36-1d56-4e07-83f6-36720207b51b/cluster-ca | |
| audience: ${{ env.OIDC_AUDIENCE }} | |
| - name: Deploy the image | |
| if: ${{ github.event_name != 'pull_request' }} | |
| env: | |
| KUBECONFIG: kubeconfig.yaml | |
| run: kubectl --namespace glvd set image deploy/glvd glvd-api=ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}:latest-linuxamd64_bare@${{ steps.bare.outputs.bare-amd64-digest }} | |
| dependency-submission: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Set up JDK 25 | |
| uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0 | |
| with: | |
| java-version: '25' | |
| distribution: 'sapmachine' | |
| # Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies. | |
| # See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md | |
| - name: Generate and submit dependency graph | |
| uses: gradle/actions/dependency-submission@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5 | |
| deploy-pages: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| pages: write | |
| needs: | |
| - build | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: build-artifacts | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 | |
| with: | |
| path: 'docs/asciidoc' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 | |