|
| 1 | +--- |
| 2 | +name: Build Spark Connect Client |
| 3 | +run-name: | |
| 4 | + Build Spark Connect Client (attempt #${{ github.run_attempt }}) |
| 5 | +
|
| 6 | +env: |
| 7 | + PRODUCT_NAME: spark-connect-client |
| 8 | + SDP_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '0.0.0-dev' }} |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + schedule: |
| 13 | + - cron: '0 0 2/2 * *' # https://crontab.guru/#0_0_2/2_*_* |
| 14 | + push: |
| 15 | + branches: [main] |
| 16 | + tags: ['*'] |
| 17 | + paths: |
| 18 | + # To check dependencies, run this ( you will need to consider transitive dependencies) |
| 19 | + # bake --product PRODUCT -d | grep -v 'docker buildx bake' | jq '.target | keys[]' |
| 20 | + - spark-k8s/** |
| 21 | + - spark-connect-client/** |
| 22 | + - stackable-base/** |
| 23 | + - java-base/** |
| 24 | + - .github/actions/** |
| 25 | + - .github/workflows/build_spark-connect-client.yaml |
| 26 | + |
| 27 | +jobs: |
| 28 | + generate_matrix: |
| 29 | + name: Generate Version List |
| 30 | + runs-on: ubuntu-latest |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 33 | + with: |
| 34 | + persist-credentials: false |
| 35 | + - id: shard |
| 36 | + uses: stackabletech/actions/shard@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 37 | + with: |
| 38 | + product-name: ${{ env.PRODUCT_NAME }} |
| 39 | + outputs: |
| 40 | + versions: ${{ steps.shard.outputs.versions }} |
| 41 | + |
| 42 | + build: |
| 43 | + name: Build/Publish ${{ matrix.versions }}-${{ matrix.runner.arch }} Image |
| 44 | + needs: [generate_matrix] |
| 45 | + permissions: |
| 46 | + id-token: write |
| 47 | + runs-on: ${{ matrix.runner.name }} |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + runner: |
| 52 | + - {name: "ubuntu-latest", arch: "amd64"} |
| 53 | + - {name: "ubicloud-standard-8-arm", arch: "arm64"} |
| 54 | + versions: ${{ fromJson(needs.generate_matrix.outputs.versions) }} |
| 55 | + steps: |
| 56 | + - name: Checkout Repository |
| 57 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 58 | + with: |
| 59 | + persist-credentials: false |
| 60 | + |
| 61 | + - name: Free Disk Space |
| 62 | + uses: stackabletech/actions/free-disk-space@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 63 | + |
| 64 | + - name: Build Product Image |
| 65 | + id: build |
| 66 | + uses: stackabletech/actions/build-product-image@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 67 | + with: |
| 68 | + product-name: ${{ env.PRODUCT_NAME }} |
| 69 | + product-version: ${{ matrix.versions }} |
| 70 | + build-cache-password: ${{ secrets.BUILD_CACHE_NEXUS_PASSWORD }} |
| 71 | + sdp-version: ${{ env.SDP_VERSION }} |
| 72 | + |
| 73 | + - name: Publish Container Image on docker.stackable.tech |
| 74 | + uses: stackabletech/actions/publish-image@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 75 | + with: |
| 76 | + image-registry-uri: docker.stackable.tech |
| 77 | + image-registry-username: github |
| 78 | + image-registry-password: ${{ secrets.NEXUS_PASSWORD }} |
| 79 | + image-repository: stackable/${{ env.PRODUCT_NAME }} |
| 80 | + image-manifest-tag: ${{ steps.build.outputs.image-manifest-tag }} |
| 81 | + source-image-uri: localhost/${{ env.PRODUCT_NAME }}:${{ steps.build.outputs.image-manifest-tag }} |
| 82 | + |
| 83 | + - name: Publish Container Image on oci.stackable.tech |
| 84 | + uses: stackabletech/actions/publish-image@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 85 | + with: |
| 86 | + image-registry-uri: oci.stackable.tech |
| 87 | + image-registry-username: robot$sdp+github-action-build |
| 88 | + image-registry-password: ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }} |
| 89 | + image-repository: sdp/${{ env.PRODUCT_NAME }} |
| 90 | + image-manifest-tag: ${{ steps.build.outputs.image-manifest-tag }} |
| 91 | + source-image-uri: localhost/${{ env.PRODUCT_NAME }}:${{ steps.build.outputs.image-manifest-tag }} |
| 92 | + |
| 93 | + publish_manifests: |
| 94 | + name: Build/Publish ${{ matrix.versions }} Manifests |
| 95 | + needs: [generate_matrix, build] |
| 96 | + permissions: |
| 97 | + id-token: write |
| 98 | + runs-on: ubuntu-latest |
| 99 | + strategy: |
| 100 | + fail-fast: false |
| 101 | + matrix: |
| 102 | + versions: ${{ fromJson(needs.generate_matrix.outputs.versions) }} |
| 103 | + steps: |
| 104 | + - name: Checkout Repository |
| 105 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 106 | + with: |
| 107 | + persist-credentials: false |
| 108 | + |
| 109 | + - name: Publish and Sign Image Index Manifest to docker.stackable.tech |
| 110 | + uses: stackabletech/actions/publish-index-manifest@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 111 | + with: |
| 112 | + image-registry-uri: docker.stackable.tech |
| 113 | + image-registry-username: github |
| 114 | + image-registry-password: ${{ secrets.NEXUS_PASSWORD }} |
| 115 | + image-repository: stackable/${{ env.PRODUCT_NAME }} |
| 116 | + image-index-manifest-tag: ${{ matrix.versions }}-stackable${{ env.SDP_VERSION }} |
| 117 | + |
| 118 | + - name: Publish and Sign Image Index Manifest to oci.stackable.tech |
| 119 | + uses: stackabletech/actions/publish-index-manifest@320eae677555385b3d40e1c3a81d9263b72742e4 # 0.6.0 |
| 120 | + with: |
| 121 | + image-registry-uri: oci.stackable.tech |
| 122 | + image-registry-username: robot$sdp+github-action-build |
| 123 | + image-registry-password: ${{ secrets.HARBOR_ROBOT_SDP_GITHUB_ACTION_BUILD_SECRET }} |
| 124 | + image-repository: sdp/${{ env.PRODUCT_NAME }} |
| 125 | + image-index-manifest-tag: ${{ matrix.versions }}-stackable${{ env.SDP_VERSION }} |
| 126 | + |
| 127 | + notify: |
| 128 | + name: Failure Notification |
| 129 | + needs: [generate_matrix, build, publish_manifests] |
| 130 | + runs-on: ubuntu-latest |
| 131 | + if: failure() |
| 132 | + steps: |
| 133 | + - uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0 |
| 134 | + with: |
| 135 | + channel-id: "C07UG6JH44F" # notifications-container-images |
| 136 | + payload: | |
| 137 | + { |
| 138 | + "text": "*${{ github.workflow }}* failed (attempt ${{ github.run_attempt }})", |
| 139 | + "attachments": [ |
| 140 | + { |
| 141 | + "pretext": "See the details below for a summary of which job(s) failed.", |
| 142 | + "color": "#aa0000", |
| 143 | + "fields": [ |
| 144 | + { |
| 145 | + "title": "Generate Version List", |
| 146 | + "short": true, |
| 147 | + "value": "${{ needs.generate_matrix.result }}" |
| 148 | + }, |
| 149 | + { |
| 150 | + "title": "Build/Publish Image", |
| 151 | + "short": true, |
| 152 | + "value": "${{ needs.build.result }}" |
| 153 | + }, |
| 154 | + { |
| 155 | + "title": "Build/Publish Manifests", |
| 156 | + "short": true, |
| 157 | + "value": "${{ needs.publish_manifests.result }}" |
| 158 | + } |
| 159 | + ], |
| 160 | + "actions": [ |
| 161 | + { |
| 162 | + "type": "button", |
| 163 | + "text": "Go to workflow run", |
| 164 | + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}" |
| 165 | + } |
| 166 | + ] |
| 167 | + } |
| 168 | + ] |
| 169 | + } |
| 170 | + env: |
| 171 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_CONTAINER_IMAGE_TOKEN }} |
0 commit comments