chore: Import certificates on the start (#240) #2
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: Build of UBI 10 based Developer Images | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| workflow_call: | |
| # Map the workflow outputs to job outputs | |
| secrets: | |
| QUAY_USERNAME: | |
| required: true | |
| QUAY_PASSWORD: | |
| required: true | |
| # outputs: | |
| # uniq_tag: | |
| # description: "The first output string" | |
| # value: ${{ jobs.build_universal_ubi10_image.outputs.output1 }} | |
| env: | |
| # Use repository variable if set, otherwise fallback to default registry | |
| REGISTRY: ${{ vars.REGISTRY || 'quay.io/devfile' }} | |
| jobs: | |
| build-base-image: | |
| name: Build base image | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runners: ['ubuntu-22.04', 'ubuntu-22.04-arm'] | |
| runs-on: ${{matrix.runners}} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set arch environment variable | |
| run: | | |
| if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then | |
| echo arch="amd64" >> $GITHUB_ENV | |
| else | |
| echo arch="arm64" >> $GITHUB_ENV | |
| fi | |
| - name: Set short_sha environment variable | |
| run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
| - name: Free runner space | |
| run: sudo rm -rf /usr/local/lib/android | |
| - name: Cleanup docker images | |
| run: docker system prune -af | |
| - name: Login to Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: Build base image | |
| run: | | |
| cd base/ubi10 && docker buildx build \ | |
| --platform linux/${{env.arch}} \ | |
| --progress=plain \ | |
| --push \ | |
| -t ${{ env.REGISTRY }}/base-developer-image:${{env.arch}}-ubi10-${{env.short_sha}} . | |
| publish-base-image: | |
| name: Publish base image | |
| runs-on: ubuntu-22.04 | |
| needs: build-base-image | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set short_sha environment variable | |
| run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
| - name: Login to Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ secrets.QUAY_USERNAME }} | |
| password: ${{ secrets.QUAY_PASSWORD }} | |
| - name: publish | |
| run: | | |
| for tag in ubi10-latest ubi10-${{env.short_sha}}; | |
| do | |
| docker manifest create ${{ env.REGISTRY }}/base-developer-image:${tag} \ | |
| --amend ${{ env.REGISTRY }}/base-developer-image:amd64-ubi10-${{env.short_sha}} \ | |
| --amend ${{ env.REGISTRY }}/base-developer-image:arm64-ubi10-${{env.short_sha}} | |
| docker manifest annotate ${{ env.REGISTRY }}/base-developer-image:${tag} \ | |
| ${{ env.REGISTRY }}/base-developer-image:amd64-ubi10-${{env.short_sha}} \ | |
| --os linux --arch amd64 | |
| docker manifest annotate ${{ env.REGISTRY }}/base-developer-image:${tag} \ | |
| ${{ env.REGISTRY }}/base-developer-image:arm64-ubi10-${{env.short_sha}} \ | |
| --os linux --arch arm64 | |
| docker manifest push ${{ env.REGISTRY }}/base-developer-image:${tag} | |
| done | |
| # build-udi: | |
| # name: Build udi | |
| # strategy: | |
| # fail-fast: false | |
| # matrix: | |
| # runners: ['ubuntu-22.04', 'ubuntu-22.04-arm'] | |
| # runs-on: ${{matrix.runners}} | |
| # needs: publish-base-image | |
| # steps: | |
| # - name: Checkout | |
| # uses: actions/checkout@v4 | |
| # - name: Set arch environment variable | |
| # run: | | |
| # if [[ ${{matrix.runners}} == 'ubuntu-22.04' ]]; then | |
| # echo arch="amd64" >> $GITHUB_ENV | |
| # else | |
| # echo arch="arm64" >> $GITHUB_ENV | |
| # fi | |
| # - name: Set short_sha environment variable | |
| # run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
| # - name: Free runner space | |
| # run: sudo rm -rf /usr/local/lib/android | |
| # - name: Cleanup docker images | |
| # run: docker system prune -af | |
| # - name: Login to Registry | |
| # uses: docker/login-action@v3 | |
| # with: | |
| # registry: ${{ env.REGISTRY }} | |
| # username: ${{ secrets.QUAY_USERNAME }} | |
| # password: ${{ secrets.QUAY_PASSWORD }} | |
| # - name: Build udi | |
| # run: | | |
| # cd universal/ubi10 && docker buildx build \ | |
| # --platform linux/${{env.arch}} \ | |
| # --progress=plain \ | |
| # --push \ | |
| # -t ${{ env.REGISTRY }}/universal-developer-image:${{env.arch}}-ubi10-${{env.short_sha}} . | |
| # publish-udi: | |
| # name: Publish udi | |
| # runs-on: ubuntu-22.04 | |
| # needs: build-udi | |
| # steps: | |
| # - name: Checkout | |
| # uses: actions/checkout@v4 | |
| # - name: Set short_sha environment variable | |
| # run: echo short_sha="$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV | |
| # - name: Login to Registry | |
| # uses: docker/login-action@v3 | |
| # with: | |
| # registry: ${{ env.REGISTRY }} | |
| # username: ${{ secrets.QUAY_USERNAME }} | |
| # password: ${{ secrets.QUAY_PASSWORD }} | |
| # - name: publish | |
| # run: | | |
| # for tag in ubi10-latest ubi10-${{env.short_sha}}; | |
| # do | |
| # docker manifest create ${{ env.REGISTRY }}/universal-developer-image:${tag} \ | |
| # --amend ${{ env.REGISTRY }}/universal-developer-image:amd64-ubi10-${{env.short_sha}} \ | |
| # --amend ${{ env.REGISTRY }}/universal-developer-image:arm64-ubi10-${{env.short_sha}} | |
| # | |
| # docker manifest annotate ${{ env.REGISTRY }}/universal-developer-image:${tag} \ | |
| # ${{ env.REGISTRY }}/universal-developer-image:amd64-ubi10-${{env.short_sha}} \ | |
| # --os linux --arch amd64 | |
| # | |
| # docker manifest annotate ${{ env.REGISTRY }}/universal-developer-image:${tag} \ | |
| # ${{ env.REGISTRY }}/universal-developer-image:arm64-ubi10-${{env.short_sha}} \ | |
| # --os linux --arch arm64 | |
| # | |
| # docker manifest push ${{ env.REGISTRY }}/universal-developer-image:${tag} | |
| # done | |
| # - name: Get tag with uniq prefix | |
| # id: setTagName | |
| # # set the image with uniq tag prefix (for example: quay.io/..../base-developer-image:ubi10-7ad6cab) to env. var | |
| # # and define it for output. This output with tag image will be used in caller job | |
| # run: | | |
| # echo "uniq_tag=${{ env.REGISTRY }}/universal-developer-image:ubi10-${{env.short_sha}}" >> $GITHUB_OUTPUT |