2023-08-03 19:19:17 +02:00
|
|
|
name: Test Infrastructure files
|
2022-10-02 21:17:16 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
2023-08-03 19:19:17 +02:00
|
|
|
paths:
|
|
|
|
- 'infrastructure_files/**'
|
|
|
|
- '.github/workflows/test-infrastructure-files.yml'
|
2022-06-24 14:50:14 +02:00
|
|
|
|
2023-04-13 17:00:01 +02:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.actor_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-06-24 14:50:14 +02:00
|
|
|
jobs:
|
2023-08-03 19:19:17 +02:00
|
|
|
test-docker-compose:
|
2022-06-24 14:50:14 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-08-24 14:37:18 +02:00
|
|
|
- name: Install jq
|
|
|
|
run: sudo apt-get install -y jq
|
|
|
|
|
|
|
|
- name: Install curl
|
|
|
|
run: sudo apt-get install -y curl
|
|
|
|
|
2022-06-24 14:50:14 +02:00
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-04-27 17:50:45 +02:00
|
|
|
go-version: "1.20.x"
|
2022-06-24 14:50:14 +02:00
|
|
|
|
|
|
|
- name: Cache Go modules
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
|
|
|
|
|
|
|
- name: Checkout code
|
2023-08-03 19:19:17 +02:00
|
|
|
uses: actions/checkout@v3
|
2022-06-24 14:50:14 +02:00
|
|
|
|
|
|
|
- name: cp setup.env
|
|
|
|
run: cp infrastructure_files/tests/setup.env infrastructure_files/
|
|
|
|
|
|
|
|
- name: run configure
|
|
|
|
working-directory: infrastructure_files
|
|
|
|
run: bash -x configure.sh
|
|
|
|
env:
|
2022-12-16 17:00:20 +01:00
|
|
|
CI_NETBIRD_DOMAIN: localhost
|
|
|
|
CI_NETBIRD_AUTH_CLIENT_ID: testing.client.id
|
2023-06-07 16:00:04 +02:00
|
|
|
CI_NETBIRD_AUTH_CLIENT_SECRET: testing.client.secret
|
2022-08-17 21:44:20 +02:00
|
|
|
CI_NETBIRD_AUTH_AUDIENCE: testing.ci
|
2022-08-24 14:37:18 +02:00
|
|
|
CI_NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT: https://example.eu.auth0.com/.well-known/openid-configuration
|
2022-08-17 21:44:20 +02:00
|
|
|
CI_NETBIRD_USE_AUTH0: true
|
2023-06-02 17:34:36 +02:00
|
|
|
CI_NETBIRD_MGMT_IDP: "none"
|
|
|
|
CI_NETBIRD_IDP_MGMT_CLIENT_ID: testing.client.id
|
|
|
|
CI_NETBIRD_IDP_MGMT_CLIENT_SECRET: testing.client.secret
|
2023-06-25 13:59:45 +02:00
|
|
|
CI_NETBIRD_AUTH_SUPPORTED_SCOPES: "openid profile email offline_access api email_verified"
|
2022-06-24 14:50:14 +02:00
|
|
|
|
|
|
|
- name: check values
|
|
|
|
working-directory: infrastructure_files
|
|
|
|
env:
|
2022-12-16 17:00:20 +01:00
|
|
|
CI_NETBIRD_DOMAIN: localhost
|
|
|
|
CI_NETBIRD_AUTH_CLIENT_ID: testing.client.id
|
2023-06-07 16:00:04 +02:00
|
|
|
CI_NETBIRD_AUTH_CLIENT_SECRET: testing.client.secret
|
2022-08-17 21:44:20 +02:00
|
|
|
CI_NETBIRD_AUTH_AUDIENCE: testing.ci
|
2022-08-24 14:37:18 +02:00
|
|
|
CI_NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT: https://example.eu.auth0.com/.well-known/openid-configuration
|
2022-08-17 21:44:20 +02:00
|
|
|
CI_NETBIRD_USE_AUTH0: true
|
2022-08-24 14:37:18 +02:00
|
|
|
CI_NETBIRD_AUTH_SUPPORTED_SCOPES: "openid profile email offline_access api email_verified"
|
|
|
|
CI_NETBIRD_AUTH_AUTHORITY: https://example.eu.auth0.com/
|
|
|
|
CI_NETBIRD_AUTH_JWT_CERTS: https://example.eu.auth0.com/.well-known/jwks.json
|
|
|
|
CI_NETBIRD_AUTH_TOKEN_ENDPOINT: https://example.eu.auth0.com/oauth/token
|
|
|
|
CI_NETBIRD_AUTH_DEVICE_AUTH_ENDPOINT: https://example.eu.auth0.com/oauth/device/code
|
2023-07-27 11:31:07 +02:00
|
|
|
CI_NETBIRD_AUTH_PKCE_AUTHORIZATION_ENDPOINT: https://example.eu.auth0.com/authorize
|
2022-10-12 12:25:46 +02:00
|
|
|
CI_NETBIRD_AUTH_REDIRECT_URI: "/peers"
|
2023-04-04 15:56:02 +02:00
|
|
|
CI_NETBIRD_TOKEN_SOURCE: "idToken"
|
|
|
|
CI_NETBIRD_AUTH_USER_ID_CLAIM: "email"
|
|
|
|
CI_NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE: "super"
|
2023-04-05 21:57:47 +02:00
|
|
|
CI_NETBIRD_AUTH_DEVICE_AUTH_SCOPE: "openid email"
|
2023-06-02 17:34:36 +02:00
|
|
|
CI_NETBIRD_MGMT_IDP: "none"
|
|
|
|
CI_NETBIRD_IDP_MGMT_CLIENT_ID: testing.client.id
|
|
|
|
CI_NETBIRD_IDP_MGMT_CLIENT_SECRET: testing.client.secret
|
2023-04-04 15:56:02 +02:00
|
|
|
|
2022-06-24 14:50:14 +02:00
|
|
|
run: |
|
2022-08-17 21:44:20 +02:00
|
|
|
grep AUTH_CLIENT_ID docker-compose.yml | grep $CI_NETBIRD_AUTH_CLIENT_ID
|
2023-06-07 16:00:04 +02:00
|
|
|
grep AUTH_CLIENT_SECRET docker-compose.yml | grep $CI_NETBIRD_AUTH_CLIENT_SECRET
|
2022-08-17 21:44:20 +02:00
|
|
|
grep AUTH_AUTHORITY docker-compose.yml | grep $CI_NETBIRD_AUTH_AUTHORITY
|
|
|
|
grep AUTH_AUDIENCE docker-compose.yml | grep $CI_NETBIRD_AUTH_AUDIENCE
|
2022-08-24 14:37:18 +02:00
|
|
|
grep AUTH_SUPPORTED_SCOPES docker-compose.yml | grep "$CI_NETBIRD_AUTH_SUPPORTED_SCOPES"
|
2022-08-17 21:44:20 +02:00
|
|
|
grep USE_AUTH0 docker-compose.yml | grep $CI_NETBIRD_USE_AUTH0
|
2022-12-16 17:00:20 +01:00
|
|
|
grep NETBIRD_MGMT_API_ENDPOINT docker-compose.yml | grep "$CI_NETBIRD_DOMAIN:33073"
|
2022-10-12 12:25:46 +02:00
|
|
|
grep AUTH_REDIRECT_URI docker-compose.yml | grep $CI_NETBIRD_AUTH_REDIRECT_URI
|
|
|
|
grep AUTH_SILENT_REDIRECT_URI docker-compose.yml | egrep 'AUTH_SILENT_REDIRECT_URI=$'
|
2023-04-04 15:56:02 +02:00
|
|
|
grep LETSENCRYPT_DOMAIN docker-compose.yml | egrep 'LETSENCRYPT_DOMAIN=$'
|
|
|
|
grep NETBIRD_TOKEN_SOURCE docker-compose.yml | grep $CI_NETBIRD_TOKEN_SOURCE
|
|
|
|
grep AuthUserIDClaim management.json | grep $CI_NETBIRD_AUTH_USER_ID_CLAIM
|
2023-07-27 11:31:07 +02:00
|
|
|
grep -A 3 DeviceAuthorizationFlow management.json | grep -A 1 ProviderConfig | grep Audience | grep $CI_NETBIRD_AUTH_DEVICE_AUTH_AUDIENCE
|
|
|
|
grep -A 8 DeviceAuthorizationFlow management.json | grep -A 6 ProviderConfig | grep Scope | grep "$CI_NETBIRD_AUTH_DEVICE_AUTH_SCOPE"
|
2023-04-05 21:57:47 +02:00
|
|
|
grep UseIDToken management.json | grep false
|
2023-06-02 17:34:36 +02:00
|
|
|
grep -A 1 IdpManagerConfig management.json | grep ManagerType | grep $CI_NETBIRD_MGMT_IDP
|
|
|
|
grep -A 3 IdpManagerConfig management.json | grep -A 1 ClientConfig | grep Issuer | grep $CI_NETBIRD_AUTH_AUTHORITY
|
|
|
|
grep -A 4 IdpManagerConfig management.json | grep -A 2 ClientConfig | grep TokenEndpoint | grep $CI_NETBIRD_AUTH_TOKEN_ENDPOINT
|
|
|
|
grep -A 5 IdpManagerConfig management.json | grep -A 3 ClientConfig | grep ClientID | grep $CI_NETBIRD_IDP_MGMT_CLIENT_ID
|
|
|
|
grep -A 6 IdpManagerConfig management.json | grep -A 4 ClientConfig | grep ClientSecret | grep $CI_NETBIRD_IDP_MGMT_CLIENT_SECRET
|
|
|
|
grep -A 7 IdpManagerConfig management.json | grep -A 5 ClientConfig | grep GrantType | grep client_credentials
|
2023-07-27 11:31:07 +02:00
|
|
|
grep -A 2 PKCEAuthorizationFlow management.json | grep -A 1 ProviderConfig | grep Audience | grep $CI_NETBIRD_AUTH_AUDIENCE
|
|
|
|
grep -A 3 PKCEAuthorizationFlow management.json | grep -A 2 ProviderConfig | grep ClientID | grep $CI_NETBIRD_AUTH_CLIENT_ID
|
|
|
|
grep -A 4 PKCEAuthorizationFlow management.json | grep -A 3 ProviderConfig | grep ClientSecret | grep $CI_NETBIRD_AUTH_CLIENT_SECRET
|
|
|
|
grep -A 5 PKCEAuthorizationFlow management.json | grep -A 4 ProviderConfig | grep AuthorizationEndpoint | grep $CI_NETBIRD_AUTH_PKCE_AUTHORIZATION_ENDPOINT
|
|
|
|
grep -A 6 PKCEAuthorizationFlow management.json | grep -A 5 ProviderConfig | grep TokenEndpoint | grep $CI_NETBIRD_AUTH_TOKEN_ENDPOINT
|
|
|
|
grep -A 7 PKCEAuthorizationFlow management.json | grep -A 6 ProviderConfig | grep Scope | grep "$CI_NETBIRD_AUTH_SUPPORTED_SCOPES"
|
2022-08-24 14:37:18 +02:00
|
|
|
|
2022-06-24 14:50:14 +02:00
|
|
|
- name: run docker compose up
|
|
|
|
working-directory: infrastructure_files
|
2023-06-02 17:34:36 +02:00
|
|
|
run: |
|
2022-06-24 14:50:14 +02:00
|
|
|
docker-compose up -d
|
|
|
|
sleep 5
|
2022-12-16 17:00:20 +01:00
|
|
|
docker-compose ps
|
|
|
|
docker-compose logs --tail=20
|
2022-06-24 14:50:14 +02:00
|
|
|
|
|
|
|
- name: test running containers
|
|
|
|
run: |
|
|
|
|
count=$(docker compose ps --format json | jq '.[] | select(.Project | contains("infrastructure_files")) | .State' | grep -c running)
|
|
|
|
test $count -eq 4
|
|
|
|
working-directory: infrastructure_files
|
2023-08-03 19:19:17 +02:00
|
|
|
|
|
|
|
test-getting-started-script:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Install jq
|
|
|
|
run: sudo apt-get install -y jq
|
|
|
|
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: run script
|
|
|
|
run: NETBIRD_DOMAIN=use-ip bash -x infrastructure_files/getting-started-with-zitadel.sh
|
|
|
|
|
|
|
|
- name: test Caddy file gen
|
|
|
|
run: test -f Caddyfile
|
|
|
|
- name: test docker-compose file gen
|
|
|
|
run: test -f docker-compose.yml
|
|
|
|
- name: test management.json file gen
|
|
|
|
run: test -f management.json
|
|
|
|
- name: test turnserver.conf file gen
|
|
|
|
run: test -f turnserver.conf
|
|
|
|
- name: test zitadel.env file gen
|
|
|
|
run: test -f zitadel.env
|
|
|
|
- name: test dashboard.env file gen
|
|
|
|
run: test -f dashboard.env
|