Test encrypted build #447
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |