Files
NLnetLabs-krill/.github/workflows/main.yml
T

93 lines
3.4 KiB
YAML

name: E2E Test
on: push
jobs:
krill_e2e_test:
env:
TF_VAR_size: s-8vcpu-32gb
name: deploy_and_test
runs-on: ubuntu-18.04
steps:
- name: checkout Krill
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: checkout the E2E test framework
uses: actions/checkout@v1
with:
repository: nlnetlabs/rpki-deploy
ref: master
fetch-depth: 1
# Use a modified Dockerfile which builds off a partially built base image
# to leverage an existing Cargo cache and thus speed up deployment.
- name: Install modified Dockerfile into Krill checkout
run: |
cp ${GITHUB_WORKSPACE}/../rpki-deploy/terraform/krill-e2e-test/lib/docker/krill/Dockerfile ${GITHUB_WORKSPACE}/../krill/Dockerfile
- name: Install Terraform
uses: marocchino/setup-terraform@v1
with:
version: "0.12.13"
- name: Install Terraform plugins
run: |
mkdir -p $HOME/.terraform.d/plugins/
cp ${GITHUB_WORKSPACE}/../rpki-deploy/terraform/plugins/terraform-provider-dockermachine $HOME/.terraform.d/plugins/
- name: Decrypt SSH key
working-directory: ../rpki-deploy/terraform/krill-e2e-test
run: |
./decrypt-ssh-key.sh
ls -la $HOME/secrets/
env:
DECRYPT_PW: ${{ secrets.DECRYPT_PW }}
# Don't lock the state file, otherwise if the user cancels the build via the
# GitHub Actions UI the terraform destroy cleanup step will fail.
- name: Deploy
working-directory: ../rpki-deploy/terraform/krill-e2e-test/run_on_do
timeout-minutes: 30
run: |
terraform init
terraform apply -lock=false -auto-approve -var "ssh_key_path=$HOME/secrets/ssh_key" -var "krill_build_path=${GITHUB_WORKSPACE}/../krill"
env:
# Don't embed env var references in env var definitions here, instead
# pass those using -var on the command line.
TF_VAR_do_token: ${{ secrets.DO_TOKEN }}
TF_VAR_run_tests: false
- name: Run tests
working-directory: ../rpki-deploy/terraform/krill-e2e-test/run_on_do
run: terraform apply -auto-approve -var "ssh_key_path=$HOME/secrets/ssh_key" -var "krill_build_path=${GITHUB_WORKSPACE}/../krill"
env:
# Don't embed env var references in env var definitions here, instead
# pass those using -var on the command line.
TF_VAR_do_token: ${{ secrets.DO_TOKEN }}
TF_VAR_run_tests: true
- name: Dump diagnostics on failure
if: failure()
working-directory: ../rpki-deploy/terraform/krill-e2e-test/run_on_do
run: |
terraform output docker_env_vars
eval $(terraform output docker_env_vars)
pushd ../lib/docker
docker-compose ps
docker-compose logs
docker system info
docker system events --since 60m --until 1s
docker exec -e KRILL_CLI_SERVER=https://localhost:3000/ -e KRILL_CLI_TOKEN=$(docker logs krill 2>&1 | tac | grep -Eom 1 'token [a-z0-9-]+' | cut -d ' ' -f 2) krill krillc list
- name: Undeploy
if: always()
working-directory: ../rpki-deploy/terraform/krill-e2e-test/run_on_do
run: terraform destroy -auto-approve -var "ssh_key_path=$HOME/secrets/ssh_key" -var "krill_build_path=${GITHUB_WORKSPACE}/../krill"
env:
# Don't embed env var references in env var definitions here, instead
# pass those using -var on the command line.
TF_VAR_do_token: ${{ secrets.DO_TOKEN }}