github: update workflow to use test project and updated workflows #11
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: windows | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
env: | |
TF_VERSION: "1.0.0" | |
ZONE: "us-east1-b" | |
strategy: | |
fail-fast: false | |
matrix: | |
agent_type: | |
- ops-agent | |
version: | |
- "2.0.1" | |
# distro is the key for determining instance name and gce image | |
distro: | |
- windows-2019 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install test utils | |
run: ./.github/scripts/setup.sh | |
env: | |
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }} | |
- name: Install Gcloud SDK | |
uses: google-github-actions/setup-gcloud@master | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
service_account_key: ${{ secrets.GCP_SA_KEY }} | |
export_default_credentials: true | |
- name: Deploy instance | |
run: ../../.github/scripts/terraform-apply.sh ${{ matrix.distro }} ${{ matrix.agent_type }} ${{ matrix.version }} | |
working-directory: ./test/terraform | |
timeout-minutes: 10 | |
- name: Configure SSH | |
run: | | |
INSTANCE=$(echo ${{ matrix.distro }}-${{ matrix.agent_type }}-${{ matrix.version }}-$(git rev-parse --short HEAD) | tr -d '.') | |
./.github/scripts/ssh.sh $INSTANCE | |
env: | |
PROJECT: ${{ secrets.GCP_PROJECT_ID }} | |
timeout-minutes: 10 | |
- name: Test Install | |
run: | | |
INSTANCE=$(echo ${{ matrix.distro }}-${{ matrix.agent_type }}-${{ matrix.version }}-$(git rev-parse --short HEAD) | tr -d '.') | |
export ADDRESS=$(gcloud --project "${PROJECT}" compute instances describe --zone "${ZONE}" "${INSTANCE}" --format=json | jq -r '.networkInterfaces[0].accessConfigs[0].natIP') | |
./.github/scripts/puppet.sh | |
./.github/scripts/inspec.sh | |
env: | |
PROJECT: ${{ secrets.GCP_PROJECT_ID }} | |
PLATFORM: windows | |
VERSION: ${{ matrix.version }} | |
AGENT_TYPE: ${{ matrix.agent_type }} | |
ACTION: install | |
timeout-minutes: 10 | |
# Windows is slow to stop services, so uninstall should be the last test | |
- name: Test Uninstall | |
run: | | |
INSTANCE=$(echo ${{ matrix.distro }}-${{ matrix.agent_type }}-${{ matrix.version }}-$(git rev-parse --short HEAD) | tr -d '.') | |
export ADDRESS=$(gcloud --project "${PROJECT}" compute instances describe --zone "${ZONE}" "${INSTANCE}" --format=json | jq -r '.networkInterfaces[0].accessConfigs[0].natIP') | |
./.github/scripts/puppet.sh | |
./.github/scripts/inspec.sh | |
env: | |
PROJECT: ${{ secrets.GCP_PROJECT_ID }} | |
PLATFORM: windows | |
VERSION: ${{ matrix.version }} | |
AGENT_TYPE: ${{ matrix.agent_type }} | |
ACTION: uninstall | |
timeout-minutes: 10 | |
- name: Test Install w/ Custom Config | |
run: | | |
INSTANCE=$(echo ${{ matrix.distro }}-${{ matrix.agent_type }}-${{ matrix.version }}-$(git rev-parse --short HEAD) | tr -d '.') | |
export ADDRESS=$(gcloud --project "${PROJECT}" compute instances describe --zone "${ZONE}" "${INSTANCE}" --format=json | jq -r '.networkInterfaces[0].accessConfigs[0].natIP') | |
./.github/scripts/puppet.sh | |
./.github/scripts/inspec.sh | |
env: | |
PROJECT: ${{ secrets.GCP_PROJECT_ID }} | |
PLATFORM: windows | |
VERSION: ${{ matrix.version }} | |
AGENT_TYPE: ${{ matrix.agent_type }} | |
ACTION: custom_config | |
timeout-minutes: 10 | |
- name: Tear down instance | |
run: ../../.github/scripts/terraform-destroy.sh ${{ matrix.distro }} ${{ matrix.agent_type }} ${{ matrix.version }} | |
working-directory: ./test/terraform | |
timeout-minutes: 20 | |
if: ${{ always() }} |