-
Notifications
You must be signed in to change notification settings - Fork 19
/
.gitlab-ci.yml
64 lines (60 loc) · 1.97 KB
/
.gitlab-ci.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
.testing_pipeline:
variables:
module_folders: "budget compartments iam monitoring security vcn"
before_script:
- export http_proxy=http://www-proxy-hqdc.us.oracle.com:80
- export https_proxy=$http_proxy
- curl https://releases.hashicorp.com/terraform/1.2.2/terraform_1.2.2_linux_amd64.zip > terraform.zip
- unzip terraform.zip -d /bin
- terraform --version
- pip install pytest
- pip install boto3
- pip install pytest_terraform
- |+
for folder in $module_folders
do
echo "$tfKey" > "$folder/tfKey"
cp testing/providers.tf "$folder/providers.tf"
for dir in $folder/*;
do
if [ -d "$dir" ]; then
echo "$tfKey" > "$dir/tfKey"
cp testing/providers.tf "$dir/providers.tf"
fi
done
done
stage: test
tags: [LZ]
image: lab-runner
unit_tests:
extends: .testing_pipeline
script:
- pytest -k terraform --tf-mod-dir=budget tests/test_budget.py
- pytest -k terraform --tf-mod-dir=compartments tests/test_compartments.py
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development"
integration_test:
extends: .testing_pipeline
script:
- pytest -m integration
only:
refs:
- merge_requests
variables:
- $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "production"
release:
stage: deploy
tags: [LZ]
image: node:17
before_script:
- npm config set strict-ssl false
- npm config set registry https://artifacthub-iad.oci.oraclecorp.com/api/npm/npmjs-registry
- npm install @semantic-release/gitlab
- npm install @semantic-release/git
script:
- npx semantic-release -b $CI_COMMIT_REF_NAME
rules:
- if: '$CI_COMMIT_BRANCH == "production"'