-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (78 loc) · 2.75 KB
/
terraform-smoke.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
name: "Terraform Provider for Juju Smoke"
on:
push:
branches: [2.9, 3.*]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- '**.go'
- 'go.mod'
- '.github/workflows/terraform-smoke.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
smoke:
name: Terraform Smoke
runs-on: [self-hosted, linux, x64, aws, xxlarge]
if: github.event.pull_request.draft == false
steps:
- name: Install Dependencies
shell: bash
run: |
set -euxo pipefail
echo "/snap/bin" >> $GITHUB_PATH
sudo DEBIAN_FRONTEND=noninteractive apt install -y expect
- name: Checkout juju
uses: actions/checkout@v4
- name: Setup LXD
uses: canonical/setup-lxd@4e959f8e0d9c5feb27d44c5e4d9a330a782edee0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true
- name: setup env
shell: bash
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Install local Juju
shell: bash
run: |
make go-install
- name: Bootstrap Juju - localhost
shell: bash
run: |
set -euxo pipefail
juju bootstrap localhost c \
--constraints "arch=$(go env GOARCH)"
juju version
- name: Find terraform provider for juju latest release
uses: actions/checkout@v4
with:
repository: 'juju/terraform-provider-juju'
#path: terraform-provider-juju
fetch-depth: 0
- name: Checkout terraform provider for juju latest release
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
git checkout $LATEST_TAG
- name: Set environment to configure provider for test
run: |
CONTROLLER=$(juju whoami --format yaml | yq .controller)
echo "JUJU_AGENT_VERSION=$(juju show-controller | yq -r .$CONTROLLER.details.agent-version)" >> $GITHUB_ENV
echo "JUJU_CONTROLLER_ADDRESSES=$(juju show-controller | yq .$CONTROLLER.details.api-endpoints | yq -r '. | join(",")')" >> $GITHUB_ENV
echo "JUJU_USERNAME=$(juju show-controller | yq .$CONTROLLER.account.user)" >> $GITHUB_ENV
echo "JUJU_PASSWORD=$(cat ~/.local/share/juju/accounts.yaml | yq .controllers.$CONTROLLER.password)" >> $GITHUB_ENV
echo "JUJU_CA_CERT<<EOF" >> $GITHUB_ENV
juju show-controller | yq .$CONTROLLER.details.ca-cert >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Run terraform provider for juju ACC tests
shell: bash
env:
TF_ACC: "1"
TEST_CLOUD: lxd
run: |
go mod download
go test -timeout 40m -v -cover ./internal/provider/