@@ -34,61 +34,45 @@ concurrency:
34
34
permissions :
35
35
contents : read
36
36
37
+ env :
38
+ CLOUDSTACK_API_URL : http://localhost:8080/client/api
39
+ CLOUDSTACK_VERSIONS : " ['4.18.2.0', '4.19.0.1']"
40
+
37
41
jobs :
38
- acceptance :
39
- name : Acceptance Tests (Terraform ${{ matrix.terraform-version }}, Cloudstack ${{ matrix.cloudstack-version }})
40
- runs-on : ubuntu-22.04
41
- env :
42
- CLOUDSTACK_API_URL : http://localhost:8080/client/api
42
+ prepare-matrix :
43
+ runs-on : ubuntu-latest
44
+ outputs :
45
+ cloudstack-versions : ${{ steps.set-versions.outputs.cloudstack-versions }}
46
+ steps :
47
+ - name : Set versions
48
+ id : set-versions
49
+ run : |
50
+ echo "cloudstack-versions=${{ env.CLOUDSTACK_VERSIONS }}" >> $GITHUB_OUTPUT
51
+
52
+ acceptance-terraform :
53
+ name : Acceptance Tests - Terraform ${{ matrix.terraform-version }}, Cloudstack ${{ matrix.cloudstack-version }}
54
+ needs : [prepare-matrix]
55
+ runs-on : ubuntu-latest
43
56
steps :
44
57
- uses : actions/checkout@v3
45
58
- name : Set up Go
46
59
uses : actions/setup-go@v3
47
60
with :
48
61
go-version-file : ' go.mod'
49
- - name : Wait Cloudstack to be ready
50
- run : |
51
- echo "Starting Cloudstack health check"
52
- T=0
53
- until [ $T -gt 20 ] || curl -sfL http://localhost:8080 --output /dev/null
54
- do
55
- echo "Waiting for Cloudstack to be ready..."
56
- ((T+=1))
57
- sleep 30
58
- done
59
- - name : Setting up Cloudstack
60
- run : |
61
- docker exec $(docker container ls --format=json -l | jq -r .ID) python /root/tools/marvin/marvin/deployDataCenter.py -i /root/setup/dev/advanced.cfg
62
- curl -sf --location "${CLOUDSTACK_API_URL}" \
63
- --header 'Content-Type: application/x-www-form-urlencoded' \
64
- --data-urlencode 'command=login' \
65
- --data-urlencode 'username=admin' \
66
- --data-urlencode 'password=password' \
67
- --data-urlencode 'response=json' \
68
- --data-urlencode 'domain=/' -j -c cookies.txt --output /dev/null
69
-
70
- CLOUDSTACK_USER_ID=$(curl -fs "${CLOUDSTACK_API_URL}?command=listUsers&response=json" -b cookies.txt | jq -r '.listusersresponse.user[0].id')
71
- CLOUDSTACK_API_KEY=$(curl -s "${CLOUDSTACK_API_URL}?command=getUserKeys&id=${CLOUDSTACK_USER_ID}&response=json" -b cookies.txt | jq -r '.getuserkeysresponse.userkeys.apikey')
72
- CLOUDSTACK_SECRET_KEY=$(curl -fs "${CLOUDSTACK_API_URL}?command=getUserKeys&id=${CLOUDSTACK_USER_ID}&response=json" -b cookies.txt | jq -r '.getuserkeysresponse.userkeys.secretkey')
73
-
74
- echo "::add-mask::$CLOUDSTACK_API_KEY"
75
- echo "::add-mask::$CLOUDSTACK_SECRET_KEY"
76
-
77
- echo "CLOUDSTACK_API_KEY=$CLOUDSTACK_API_KEY" >> $GITHUB_ENV
78
- echo "CLOUDSTACK_SECRET_KEY=$CLOUDSTACK_SECRET_KEY" >> $GITHUB_ENV
79
- echo "CLOUDSTACK_TEMPLATE_URL=http://dl.openvm.eu/cloudstack/macchinina/x86_64/macchinina-xen.vhd.bz2" >> $GITHUB_ENV
80
- - name : Install CMK
81
- run : |
82
- curl -sfL https://github.com/apache/cloudstack-cloudmonkey/releases/download/6.3.0/cmk.linux.x86-64 -o /usr/local/bin/cmk
83
- chmod +x /usr/local/bin/cmk
84
- - name : Create extra resources
85
- run : |
86
- cmk -u $CLOUDSTACK_API_URL -k $CLOUDSTACK_API_KEY -s $CLOUDSTACK_SECRET_KEY -o json create project name=terraform displaytext=terraform
62
+ - name : Setup Cloudstack v${{ matrix.cloudstack-version }}
63
+ uses : ./.github/workflows/setup-cloudstack
64
+ id : setup-cloudstack
65
+ with :
66
+ cloudstack-version : ${{ matrix.cloudstack-version }}
87
67
- uses : hashicorp/setup-terraform@v3
88
68
with :
89
69
terraform_version : ${{ matrix.terraform-version }}
90
70
terraform_wrapper : false
91
71
- name : Run acceptance test
72
+ env :
73
+ CLOUDSTACK_USER_ID : ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_USER_ID }}
74
+ CLOUDSTACK_API_KEY : ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_API_KEY }}
75
+ CLOUDSTACK_SECRET_KEY : ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_SECRET_KEY }}
92
76
run : |
93
77
make testacc
94
78
services :
102
86
terraform-version :
103
87
- ' 1.7.*'
104
88
- ' 1.8.*'
105
- cloudstack-version :
106
- - 4.18.2.0
107
- - 4.19.0.1
89
+ cloudstack-version : ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }}
0 commit comments