Skip to content

Commit b3ed48d

Browse files
committed
ci: test AWS OIDC for Nix releases
DO NOT MERGE This is a test run to check that the IAM role and OIDC setup on the AWS account is setup correctly.
1 parent 4a2fb18 commit b3ed48d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Test Release OIDC
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
11+
jobs:
12+
oidc-check:
13+
runs-on: ubuntu-latest
14+
environment: releases
15+
steps:
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@v4
18+
with:
19+
role-to-assume: "arn:aws:iam::080433136561:role/nix-release"
20+
role-session-name: nix-release-oidc-test-${{ github.run_id }}
21+
aws-region: eu-west-1
22+
23+
- name: Verify AWS identity
24+
run: aws sts get-caller-identity
25+
26+
- name: Confirm access to release bucket
27+
run: |
28+
set -euo pipefail
29+
KEY=$(aws s3api list-objects-v2 \
30+
--bucket nix-releases \
31+
--prefix nix/ \
32+
--query 'reverse(sort_by(Contents, &LastModified)) | [?StorageClass!=`GLACIER` && StorageClass!=`DEEP_ARCHIVE`][0].Key' \
33+
--output text)
34+
if [ "$KEY" = "None" ] || [ -z "$KEY" ]; then
35+
echo "No objects found under nix/ prefix in nix-releases bucket" >&2
36+
exit 1
37+
fi
38+
echo "Found object $KEY"
39+
aws s3 cp "s3://nix-releases/$KEY" - >/dev/null

0 commit comments

Comments
 (0)