Skip to content

github: update workflow to use test project and updated workflows #16

github: update workflow to use test project and updated workflows

github: update workflow to use test project and updated workflows #16

Workflow file for this run

---
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: Authenticate using ServiceAccount
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'
- 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() }}