Skip to content

Commit 05dc88b

Browse files
authored
Merge pull request #71 from fabiomatavelli/feature/update-sdk
Update SDKs
2 parents e4c9861 + 8e2b79f commit 05dc88b

File tree

104 files changed

+1093
-1074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+1093
-1074
lines changed

.github/workflows/acceptance.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Acceptance Test
19+
20+
on:
21+
pull_request:
22+
paths:
23+
- .github/workflows/acceptance.yml
24+
- '**.go'
25+
push:
26+
paths:
27+
- .github/workflows/acceptance.yml
28+
- '**.go'
29+
30+
concurrency:
31+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-acceptance
32+
cancel-in-progress: true
33+
34+
permissions:
35+
contents: read
36+
37+
env:
38+
CLOUDSTACK_API_URL: http://localhost:8080/client/api
39+
CLOUDSTACK_VERSIONS: "['4.18.2.0', '4.19.0.1']"
40+
41+
jobs:
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: Terraform ${{ matrix.terraform-version }} with Cloudstack ${{ matrix.cloudstack-version }}
54+
needs: [prepare-matrix]
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- name: Set up Go
59+
uses: actions/setup-go@v5
60+
with:
61+
go-version-file: 'go.mod'
62+
- name: Configure Cloudstack v${{ matrix.cloudstack-version }}
63+
uses: ./.github/workflows/setup-cloudstack
64+
id: setup-cloudstack
65+
with:
66+
cloudstack-version: ${{ matrix.cloudstack-version }}
67+
- uses: hashicorp/setup-terraform@v3
68+
with:
69+
terraform_version: ${{ matrix.terraform-version }}
70+
terraform_wrapper: false
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 }}
76+
run: |
77+
make testacc
78+
services:
79+
cloudstack-simulator:
80+
image: apache/cloudstack-simulator:${{ matrix.cloudstack-version }}
81+
ports:
82+
- 8080:5050
83+
strategy:
84+
fail-fast: false
85+
matrix:
86+
terraform-version:
87+
- '1.7.*'
88+
- '1.8.*'
89+
cloudstack-version: ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }}
90+
91+
acceptance-opentofu:
92+
name: OpenTofu ${{ matrix.opentofu-version }} with Cloudstack ${{ matrix.cloudstack-version }}
93+
needs: [prepare-matrix]
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
- name: Set up Go
98+
uses: actions/setup-go@v5
99+
with:
100+
go-version-file: 'go.mod'
101+
- name: Configure Cloudstack v${{ matrix.cloudstack-version }}
102+
uses: ./.github/workflows/setup-cloudstack
103+
id: setup-cloudstack
104+
with:
105+
cloudstack-version: ${{ matrix.cloudstack-version }}
106+
- uses: opentofu/setup-opentofu@v1
107+
with:
108+
tofu_version: ${{ matrix.opentofu-version }}
109+
- name: Run acceptance test
110+
env:
111+
CLOUDSTACK_USER_ID: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_USER_ID }}
112+
CLOUDSTACK_API_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_API_KEY }}
113+
CLOUDSTACK_SECRET_KEY: ${{ steps.setup-cloudstack.outputs.CLOUDSTACK_SECRET_KEY }}
114+
run: |
115+
make testacc
116+
services:
117+
cloudstack-simulator:
118+
image: apache/cloudstack-simulator:${{ matrix.cloudstack-version }}
119+
ports:
120+
- 8080:5050
121+
strategy:
122+
fail-fast: false
123+
matrix:
124+
opentofu-version:
125+
- '1.6.*'
126+
cloudstack-version: ${{ fromJson(needs.prepare-matrix.outputs.cloudstack-versions) }}
127+
128+
all-jobs-passed: # Will succeed if it is skipped
129+
runs-on: ubuntu-latest
130+
needs: [acceptance-terraform, acceptance-opentofu]
131+
# Only run if any of the previous jobs failed
132+
if: ${{ failure() }}
133+
steps:
134+
- name: Previous jobs failed
135+
run: exit 1

.github/workflows/build.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,24 @@ on: [push, pull_request]
2222
concurrency:
2323
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2424
cancel-in-progress: true
25-
2625
permissions:
2726
contents: read
2827

2928
jobs:
3029
build:
3130
runs-on: ubuntu-22.04
32-
31+
3332
steps:
34-
- uses: actions/checkout@v3
35-
36-
- name: Set up Go
37-
uses: actions/setup-go@v3
38-
with:
39-
go-version: 1.19.x
40-
41-
- name: Build
42-
run: |
43-
make build
44-
45-
- name: Test
46-
run: make test
33+
- uses: actions/checkout@v3
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@v3
37+
with:
38+
go-version-file: 'go.mod'
39+
40+
- name: Build
41+
run: |
42+
make build
43+
44+
- name: Test
45+
run: make test
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: Setup Cloudstack
19+
20+
inputs:
21+
cloudstack-version:
22+
description: 'Cloudstack version'
23+
required: true
24+
outputs:
25+
CLOUDSTACK_USER_ID:
26+
description: 'Cloudstack user id'
27+
value: ${{ steps.setup-cloudstack.outputs.user_id }}
28+
CLOUDSTACK_API_KEY:
29+
description: 'Cloudstack api key'
30+
value: ${{ steps.setup-cloudstack.outputs.api_key }}
31+
CLOUDSTACK_SECRET_KEY:
32+
description: 'Cloudstack secret key'
33+
value: ${{ steps.setup-cloudstack.outputs.secret_key }}
34+
CLOUDSTACK_API_URL:
35+
description: 'Cloudstack API URL'
36+
value: http://localhost:8080/client/api
37+
38+
runs:
39+
using: composite
40+
steps:
41+
- name: Wait Cloudstack to be ready
42+
shell: bash
43+
run: |
44+
echo "Starting Cloudstack health check"
45+
T=0
46+
until [ $T -gt 20 ] || curl -sfL http://localhost:8080 --output /dev/null
47+
do
48+
echo "Waiting for Cloudstack to be ready..."
49+
((T+=1))
50+
sleep 30
51+
done
52+
- name: Setting up Cloudstack
53+
id: setup-cloudstack
54+
shell: bash
55+
run: |
56+
docker exec $(docker container ls --format=json -l | jq -r .ID) python /root/tools/marvin/marvin/deployDataCenter.py -i /root/setup/dev/advanced.cfg
57+
curl -sf --location "${CLOUDSTACK_API_URL}" \
58+
--header 'Content-Type: application/x-www-form-urlencoded' \
59+
--data-urlencode 'command=login' \
60+
--data-urlencode 'username=admin' \
61+
--data-urlencode 'password=password' \
62+
--data-urlencode 'response=json' \
63+
--data-urlencode 'domain=/' -j -c cookies.txt --output /dev/null
64+
65+
CLOUDSTACK_USER_ID=$(curl -fs "${CLOUDSTACK_API_URL}?command=listUsers&response=json" -b cookies.txt | jq -r '.listusersresponse.user[0].id')
66+
CLOUDSTACK_API_KEY=$(curl -s "${CLOUDSTACK_API_URL}?command=getUserKeys&id=${CLOUDSTACK_USER_ID}&response=json" -b cookies.txt | jq -r '.getuserkeysresponse.userkeys.apikey')
67+
CLOUDSTACK_SECRET_KEY=$(curl -fs "${CLOUDSTACK_API_URL}?command=getUserKeys&id=${CLOUDSTACK_USER_ID}&response=json" -b cookies.txt | jq -r '.getuserkeysresponse.userkeys.secretkey')
68+
69+
echo "::add-mask::$CLOUDSTACK_API_KEY"
70+
echo "::add-mask::$CLOUDSTACK_SECRET_KEY"
71+
72+
echo "user_id=$CLOUDSTACK_USER_ID" >> $GITHUB_OUTPUT
73+
echo "api_key=$CLOUDSTACK_API_KEY" >> $GITHUB_OUTPUT
74+
echo "secret_key=$CLOUDSTACK_SECRET_KEY" >> $GITHUB_OUTPUT
75+
- name: Install CMK
76+
shell: bash
77+
run: |
78+
curl -sfL https://github.com/apache/cloudstack-cloudmonkey/releases/download/6.3.0/cmk.linux.x86-64 -o /usr/local/bin/cmk
79+
chmod +x /usr/local/bin/cmk
80+
- name: Create extra resources
81+
shell: bash
82+
run: |
83+
cmk -u $CLOUDSTACK_API_URL -k $CLOUDSTACK_API_KEY -s $CLOUDSTACK_SECRET_KEY -o json create project name=terraform displaytext=terraform

.github/workflows/testacc.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)