|
20 | 20 | docker-build-platforms: |
21 | 21 | required: false |
22 | 22 | type: string |
23 | | - default: "linux/amd64,linux/arm64" |
| 23 | + default: "linux/amd64" |
24 | 24 | docker-build-provenance: |
25 | 25 | required: false |
26 | 26 | type: string |
|
72 | 72 | required: false |
73 | 73 | type: string |
74 | 74 | default: "ubuntu-24.04" |
| 75 | + runs-on-arm: |
| 76 | + required: false |
| 77 | + type: string |
| 78 | + default: "ubuntu-24.04-arm" |
75 | 79 | upwind-organization-id: |
76 | 80 | required: false |
77 | 81 | type: string |
|
101 | 105 | required: false |
102 | 106 |
|
103 | 107 | jobs: |
| 108 | + prepare-matrix: |
| 109 | + runs-on: ubuntu-latest |
| 110 | + outputs: |
| 111 | + matrix: ${{ steps.set-matrix.outputs.matrix }} |
| 112 | + steps: |
| 113 | + - name: Generate Matrix |
| 114 | + id: set-matrix |
| 115 | + shell: python |
| 116 | + run: | |
| 117 | + import os |
| 118 | + import json |
| 119 | +
|
| 120 | + platforms_input = "${{ inputs.docker-build-platforms }}" |
| 121 | + amd64_runner = "${{ inputs.runs-on }}" |
| 122 | + arm64_runner = "${{ inputs.runs-on-arm }}" |
| 123 | + |
| 124 | + # split input "linux/amd64,linux/arm64" into list |
| 125 | + platforms = [p.strip() for p in platforms_input.split(',') if p.strip()] |
| 126 | + |
| 127 | + include = [] |
| 128 | + for p in platforms: |
| 129 | + runner = amd64_runner |
| 130 | + # Map linux/arm64 to a specific ARM runner |
| 131 | + # Adjust 'ubuntu-24.04-arm' to GitHub availability |
| 132 | + if "arm64" in p: |
| 133 | + runner = arm64_runner |
| 134 | + |
| 135 | + include.append({"platform": p, "runner": runner}) |
| 136 | +
|
| 137 | + matrix = {"include": include} |
| 138 | + |
| 139 | + with open(os.environ['GITHUB_OUTPUT'], 'a') as f: |
| 140 | + f.write(f"matrix={json.dumps(matrix)}") |
| 141 | +
|
104 | 142 | gitops: |
105 | | - name: GitOps |
106 | | - runs-on: ${{ inputs.runs-on }} |
| 143 | + name: GitOps (${{ matrix.platform }}) |
| 144 | + needs: prepare-matrix |
| 145 | + strategy: |
| 146 | + fail-fast: true |
| 147 | + matrix: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }} |
| 148 | + runs-on: ${{ matrix.runner }} |
107 | 149 | if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') |
108 | 150 |
|
109 | 151 | env: |
@@ -136,7 +178,7 @@ jobs: |
136 | 178 | docker-build-secret-files: ${{ secrets.docker-build-secret-files }} |
137 | 179 | docker-build-target: ${{ inputs.docker-build-target }} |
138 | 180 | docker-build-outputs: ${{ inputs.docker-build-outputs }} |
139 | | - docker-build-platforms: ${{ inputs.docker-build-platforms }} |
| 181 | + docker-build-platforms: ${{ matrix.platform }} |
140 | 182 | docker-build-provenance: ${{ inputs.docker-build-provenance }} |
141 | 183 | docker-disable-retagging: ${{ inputs.docker-disable-retagging }} |
142 | 184 | docker-file: ${{ inputs.docker-file }} |
|
0 commit comments