-
Notifications
You must be signed in to change notification settings - Fork 13
137 lines (126 loc) · 4.83 KB
/
linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
name: linux
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
- logging
- monitoring
version:
- "2.0.1"
- latest
# distro is the key for determining instance name and gce image
distro:
- ubuntu-2004
- ubuntu-1804
- ubuntu-1604
- debian-10
- debian-9
- centos-s8
- centos-8
- centos-7
- rhel-8
- rhel-7
- suse-15
- suse-12
exclude:
# invalid combos
- agent_type: logging
version: "2.0.1"
- agent_type: monitoring
version: "2.0.1"
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: linux
VERSION: ${{ matrix.version }}
AGENT_TYPE: ${{ matrix.agent_type }}
ACTION: install
timeout-minutes: 10
- name: Test Upgrade
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: linux
VERSION: ${{ matrix.version }}
AGENT_TYPE: ${{ matrix.agent_type }}
ACTION: upgrade
timeout-minutes: 10
if: matrix.version != 'latest'
- 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: linux
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: linux
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() }}