-
Notifications
You must be signed in to change notification settings - Fork 2
119 lines (100 loc) · 3.25 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Test encrypted build
on:
workflow_run:
workflows:
- "Build image and push"
branches:
- main
types:
- completed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
encrypt:
runs-on: ubuntu-latest
container: ghcr.io/thaibault/containerbase:latest
# NOTE: Theses environment variables are only needed to test the encrypt
# script.
env:
DECRYPTED_PATHS: testSimple/
ENCRYPTED_PATHS: testEncryption/
PASSWORD_FILE_PATHS: testAdvanced/.encryptionPassword
steps:
- uses: actions/[email protected]
- run: ./scripts/encrypt.sh
- run: ls --all --human-readable -l testEncryption
- run: rm --force --recursive testEncryption
buildAndRunSimple:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/[email protected]
- name: Build image
uses: docker/[email protected]
with:
context: ./testSimple
push: false
tags: test-simple:latest
- uses: addnab/docker-run-action@v3
with:
image: test-simple:latest
run: /usr/bin/initialize
buildAndRunEnvironment:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/[email protected]
- name: Build image
uses: docker/[email protected]
with:
context: ./testSimple
push: false
tags: test-environment:latest
- uses: addnab/docker-run-action@v3
with:
image: test-environment:latest
options: --mount type=bind,source=${{ github.workspace }}/testAdvanced/.encryptionPassword,target=/var/run/credentials/password
run: /usr/bin/initialize
buildAndRunAdvanced:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/[email protected]
- name: Build image
uses: docker/[email protected]
with:
context: ./testAdvanced
push: false
tags: test-advanced:latest
# Decrypt with hidden mounted password file.
- uses: addnab/docker-run-action@v3
with:
image: test-advanced:latest
options: --mount type=bind,source=${{ github.workspace }}/testAdvanced/.encryptionPassword,target=/application/.encryptionPassword
run: /usr/bin/initialize
# Decrypt with password provided as command line argument
- uses: addnab/docker-run-action@v3
with:
image: test-advanced:latest
run: /usr/bin/initialize test
# Decrypt with password provided as environment variable.
- uses: addnab/docker-run-action@v3
with:
image: test-advanced:latest
options: --env DECRYPTION_PASSWORD=test
run: /usr/bin/initialize
# Decrypt with password provided as secret.
- uses: addnab/docker-run-action@v3
with:
image: test-advanced:latest
options: --mount type=bind,source=${{ github.workspace }}/testAdvanced/.encryptionPassword,target=/run/secrets/encryption_password
run: /usr/bin/initialize