-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (113 loc) · 4.34 KB
/
tests-integration.yaml
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
name: Observe Agent Integration Tests
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
schedule:
- cron: "0 7 * * *" #Runs at 07:00 UTC Daily
#Special permissions required for OIDC authentication
permissions:
id-token: write
contents: write
pull-requests: write
env:
TF_VAR_name_format: "tf-observe-agent-test-%s"
TF_VAR_PUBLIC_KEY_PATH: "./test_key.pub"
TF_VAR_PRIVATE_KEY_PATH: "./test_key.pem"
TF_VAR_OBSERVE_URL: ${{secrets.OBSERVE_URL}}
TF_VAR_OBSERVE_TOKEN: ${{secrets.OBSERVE_TOKEN}}
jobs:
build:
runs-on: ubuntu-observe-agent-8cpu
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.7
- name: Install msitools
run: sudo apt-get install -y wixl
- name: Install qemu
uses: docker/setup-qemu-action@v3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: '2.4.4'
args: release --prepare --clean --snapshot --verbose --parallelism 8
env:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Save docker as .tar #Save docker images to tar
run: |
amd64_image=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep "amd64"| grep "observe-agent" | sort -r -k4 | head -n 1)
arm64v8_image=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep "arm64v8"| grep "observe-agent" | sort -r -k4 | head -n 1)
echo "amd64_image: ${amd64_image}"
echo "arm64v8_image: ${arm64v8_image}"
docker save -o dist/observe-agent_docker_arm64v8.tar ${arm64v8_image}
docker save -o dist/observe-agent_docker_amd64.tar ${amd64_image}
- run: ls -l && ls -l dist/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 10
observe-agent-integration-tests:
name: observe-agent-integration-tests-${{ matrix.AWS_MACHINE}}
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
AWS_MACHINE: ["AMAZON_LINUX_2023", "UBUNTU_22_04_LTS", "WINDOWS_SERVER_2016_BASE", "WINDOWS_SERVER_2019_BASE", "WINDOWS_SERVER_2022_BASE", "DOCKER_AMD64_UBUNTU_22_04_LTS"]
defaults:
run:
working-directory: integration #Terrafrom commands and tests are ran from integration directory
steps:
- name: Checkout code
uses: actions/checkout@v4
- run: git branch && df -h
- name: Configure AWS Credentials ## Terraform provider automatically uses these creds
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ github.sha }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install -r scripts/requirements.txt
- name: Setup SSH Keys
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ${{env.TF_VAR_PRIVATE_KEY_PATH}}
chmod 600 ${{env.TF_VAR_PRIVATE_KEY_PATH}}
echo "${{ secrets.SSH_PUBLIC_KEY }}" >${{env.TF_VAR_PUBLIC_KEY_PATH}}
chmod 644 ${{env.TF_VAR_PUBLIC_KEY_PATH}}
- name: Setup additional terraform variable
run: echo "TF_VAR_AWS_MACHINE=$(echo ${{matrix.AWS_MACHINE}})" >> $GITHUB_ENV
- name: Download build artifacts
uses: actions/download-artifact@v4
id: artifact-download-step
with:
name: dist
path: dist
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.5
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Test
id: test
run: |
terraform test -verbose