Release 1.10.1 #538
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: Build | |
| permissions: {} | |
| on: | |
| pull_request: | |
| merge_group: | |
| push: | |
| branches: | |
| - develop | |
| tags: | |
| - '*' | |
| jobs: | |
| Base-Container: | |
| name: Build Base Container Image | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKERFILE: ./Dockerfile.base | |
| DOCKER_IMAGE_NAME: cloudtooling/dev-buildbox-base | |
| VERSION_FILE: config_base.json | |
| steps: &container-build | |
| - uses: actions/checkout@v7 | |
| - name: Write version vars | |
| id: version-vars | |
| run: | | |
| BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` | |
| BRANCH=${GITHUB_REF_NAME#v} | |
| APP_VERSION=$(cat $VERSION_FILE | grep version| head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | sed 's/ //g') | |
| echo Version: $APP_VERSION | |
| /bin/cat <<EOM >>$GITHUB_ENV | |
| VERSION=$APP_VERSION | |
| APP_VERSION=$APP_VERSION | |
| BUILD_DATE=$BUILD_DATE | |
| EOM | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ vars.DOCKER_HUB_USER }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Build Docker image | |
| id: build-image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ${{env.DOCKERFILE}} | |
| push: false | |
| tags: | | |
| ${{env.DOCKER_IMAGE_NAME}}:latest | |
| ${{env.DOCKER_IMAGE_NAME}}:next | |
| ${{env.DOCKER_IMAGE_NAME}}:${{ github.run_id }} | |
| ${{env.DOCKER_IMAGE_NAME}}:${{ env.APP_VERSION }} | |
| build-args: | | |
| BUILD_DATE=${{env.BUILD_DATE}} | |
| APP_VERSION=${{env.APP_VERSION}} | |
| platforms: linux/amd64,linux/arm64 | |
| if: github.ref_type != 'tag' | |
| - name: Push To Docker Hub | |
| id: push-to-dockerhub-preview | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ${{env.DOCKERFILE}} | |
| push: true | |
| tags: | | |
| ${{env.DOCKER_IMAGE_NAME}}:next | |
| ${{env.DOCKER_IMAGE_NAME}}:${{ github.run_id }} | |
| build-args: | | |
| BUILD_DATE=${{env.BUILD_DATE}} | |
| APP_VERSION=${{env.APP_VERSION}} | |
| platforms: linux/amd64,linux/arm64 | |
| if: github.ref_type != 'tag' | |
| - name: Push To Docker Hub | |
| id: push-to-dockerhub-tagged | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ${{env.DOCKERFILE}} | |
| push: true | |
| tags: | | |
| ${{env.DOCKER_IMAGE_NAME}}:latest | |
| ${{env.DOCKER_IMAGE_NAME}}:${{ github.run_id }} | |
| ${{env.DOCKER_IMAGE_NAME}}:${{ env.APP_VERSION }} | |
| build-args: | | |
| BUILD_DATE=${{env.BUILD_DATE}} | |
| APP_VERSION=${{env.BRANCH}} | |
| platforms: linux/amd64,linux/arm64 | |
| if: github.ref_type == 'tag' || github.tag != '' | |
| Container: | |
| name: Build Container Image | |
| runs-on: ubuntu-latest | |
| env: | |
| DOCKERFILE: ./Dockerfile | |
| DOCKER_IMAGE_NAME: cloudtooling/dev-buildbox | |
| VERSION_FILE: config.json | |
| steps: *container-build | |
| End2End-Tests: | |
| name: End2End Testing | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| container: cloudtooling/dev-buildbox:${{ github.run_id }} | |
| needs: | |
| - Base-Container | |
| - Container | |
| steps: &container-build | |
| - uses: actions/checkout@v7 | |
| - name: Setup Environment | |
| id: setup-env | |
| run: | | |
| apt-get update | |
| apt-get install -y sudo | |
| - name: Setup Bats and bats libs | |
| id: setup-bats | |
| uses: bats-core/bats-action@4.0.0 | |
| - name: Run BATS tests | |
| shell: bash | |
| env: | |
| BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} | |
| TERM: xterm | |
| run: test/shell/.bin/run-tests.sh | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@v6 | |
| # always run even if the previous step fails | |
| if: success() || failure() | |
| with: | |
| report_paths: 'reports/*.xml' | |
| Build-results: | |
| name: Build results | |
| if: ${{ always() }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - Base-Container | |
| - Container | |
| - End2End-Tests | |
| steps: | |
| - run: exit 1 | |
| # see https://stackoverflow.com/a/67532120/4907315 | |
| if: >- | |
| ${{ | |
| contains(needs.*.result, 'failure') | |
| || contains(needs.*.result, 'cancelled') | |
| || contains(needs.*.result, 'skipped') | |
| }} |