1212 - main
1313 - release-*
1414
15+ permissions :
16+ id-token : write # Require write permission to Fetch an OIDC token.
17+ contents : read
18+
1519jobs :
1620 lint :
1721 name : Lint Code Base
3640 VALIDATE_CHECKOV : false
3741 VALIDATE_MARKDOWN : false
3842 VALIDATE_JSCPD : false
43+ VALIDATE_SHELL_SHFMT : false
3944 test :
4045 name : Unit Testing and Build
4146 runs-on : ubuntu-latest
6267 # the binary will be used in E2E test
6368 python3 ./scripts/build.py v0.0.1 linux-x64 --enable-aot
6469 - name : Upload Linux artifact
65- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
6670 uses : actions/upload-artifact@v4
6771 with :
6872 name : linux-amd64-binary
7377 # the binary will be used in E2E test
7478 python3 ./scripts/build.py v0.0.1 osx-x64
7579 - name : Upload macOS artifact
76- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
7780 uses : actions/upload-artifact@v4
7881 with :
7982 name : darwin-amd64-binary
8285 e2e-mariner-container :
8386 name : E2E testing for Mariner container
8487 runs-on : ubuntu-latest
88+ environment : E2E
8589 needs : test
86- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
8790 steps :
8891 - name : Check out code into the project directory
8992 uses : actions/checkout@v4
@@ -101,15 +104,33 @@ jobs:
101104 docker push localhost:5000/hello-world:v1
102105 - name : Build notation-akv:v1 image
103106 run : docker build -t notation-akv:v1 -f ./test/e2e/containerized/Dockerfile.mariner .
107+ - name : Install OIDC Client from Core Package
108+ run :
npm install @actions/[email protected] @actions/http-client 109+ - name : Write Id Token
110+ uses : actions/github-script@v6
111+ id : idtoken
112+ with :
113+ script : |
114+ try {
115+ const core = require('@actions/core')
116+ const fs = require('fs')
117+ let id_token = await core.getIDToken('api://AzureADTokenExchange')
118+ fs.writeFileSync("./federated_token", id_token);
119+ console.log(`Federated Token written to ./federated_token`);
120+ } catch (error) {
121+ core.setFailed(`Action failed with error: ${error.message}`);
122+ }
104123 - name : Run e2e
105124 run : bash ./test/e2e/containerized/test.sh
106125 env :
107- AZURE_CREDENTIALS : ${{ secrets.AZURE_CREDENTIALS }}
126+ AZURE_CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
127+ AZURE_TENANT_ID : ${{ secrets.AZURE_TENANT_ID }}
128+ AZURE_FEDERATED_TOKEN_FILE : ./federated_token
108129 e2e-linux :
109130 name : E2E testing on Linux
110131 runs-on : ubuntu-latest
132+ environment : E2E
111133 needs : test
112- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
113134 steps :
114135 - name : Check out code into the project directory
115136 uses : actions/checkout@v4
@@ -137,7 +158,9 @@ jobs:
137158 - name : Azure login
138159 uses : azure/login@v2
139160 with :
140- creds : ${{ secrets.AZURE_CREDENTIALS }}
161+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
162+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
163+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
141164 - name : E2E testing
142165 uses : ./test/e2e
143166 with :
@@ -146,8 +169,8 @@ jobs:
146169 e2e-windows :
147170 name : E2E testing on Windows
148171 runs-on : windows-latest
172+ environment : E2E
149173 needs : test
150- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
151174 steps :
152175 - name : Check out code into the project directory
153176 uses : actions/checkout@v4
@@ -180,7 +203,9 @@ jobs:
180203 - name : Azure login
181204 uses : azure/login@v2
182205 with :
183- creds : ${{ secrets.AZURE_CREDENTIALS }}
206+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
207+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
208+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
184209 - name : E2E testing
185210 uses : ./test/e2e
186211 with :
@@ -189,8 +214,8 @@ jobs:
189214 e2e-macos :
190215 name : E2E testing on macOS
191216 runs-on : macos-13
217+ environment : E2E
192218 needs : test
193- if : github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'push'
194219 steps :
195220 - name : Check out code into the project directory
196221 uses : actions/checkout@v4
@@ -223,7 +248,9 @@ jobs:
223248 - name : Azure login
224249 uses : azure/login@v2
225250 with :
226- creds : ${{ secrets.AZURE_CREDENTIALS }}
251+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
252+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
253+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
227254 - name : E2E testing
228255 uses : ./test/e2e
229256 with :
0 commit comments