Skip to content

Commit 5b72bef

Browse files
committed
ci(airflow): Migrate build workflow to reusable workflow
1 parent a27ecf5 commit 5b72bef

File tree

1 file changed

+10
-147
lines changed

1 file changed

+10
-147
lines changed

.github/workflows/build_airflow.yaml

Lines changed: 10 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: Build Airflow
33
run-name: |
44
Build Airflow (attempt #${{ github.run_attempt }})
55
6-
env:
7-
PRODUCT_NAME: airflow
8-
SDP_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || '0.0.0-dev' }}
9-
106
on:
117
workflow_dispatch:
128
schedule:
@@ -22,148 +18,15 @@ on:
2218
- stackable-base/**
2319
- .github/actions/**
2420
- .github/workflows/build_airflow.yaml
21+
- .github/workflows/reusable_build_image.yaml
2522

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

0 commit comments

Comments
 (0)