Skip to content

Commit 0b1adbc

Browse files
committed
build: experimenting -- do not merge
1 parent 1ea86ea commit 0b1adbc

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Secrets Testing
2+
3+
on:
4+
push:
5+
branches: [main,build-secrets-testing]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
13+
jobs:
14+
secrets-testing:
15+
name: Secrets Testing
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Write secret to file
25+
run: |
26+
cat > /tmp/test_secret.txt <<'EOF'
27+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
28+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
29+
<localRepository/>
30+
<interactiveMode/>
31+
<offline/>
32+
<userName>
33+
${{ secrets.NICKLAS_TEST_SECRET }}
34+
</userName>
35+
<servers/>
36+
<mirrors/>
37+
<proxies/>
38+
<profiles/>
39+
<!-- Never do this at home kids! -->
40+
<activeProfiles/>
41+
</settings>
42+
EOF
43+
44+
- name: test secrets
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: .
48+
target: secrets-testing.print
49+
push: false
50+
outputs: type=local,dest=./out
51+
secret-files: |
52+
test_secret=/tmp/test_secret.txt
53+
54+
- name: Print extracted secret
55+
run: |
56+
echo "=== Extracted secret contents ==="
57+
cat ./out/secret.txt

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,15 @@ FROM openfeature-provider-js.test AS openfeature-provider-js.test_e2e
416416
RUN --mount=type=secret,id=js_e2e_test_env,target=.env.test \
417417
make test-e2e
418418

419+
# ==============================================================================
420+
# Test Secrets
421+
# ==============================================================================
422+
FROM alpine AS secrets-testing.print
423+
424+
# Never do this at home kids!
425+
RUN --mount=type=secret,id=test_secret,target=/run/secrets/secret.txt \
426+
cp /run/secrets/secret.txt /secret.txt
427+
419428
# ==============================================================================
420429
# Build OpenFeature Provider
421430
# ==============================================================================

0 commit comments

Comments
 (0)