/
config.yml
144 lines (141 loc) · 5.18 KB
/
config.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
env: &env
environment:
GRUNTWORK_INSTALLER_VERSION: v0.0.38
TERRATEST_LOG_PARSER_VERSION: v0.40.6
MODULE_CI_VERSION: v0.56.0
TERRAFORM_VERSION: 1.2.7
TERRAGRUNT_VERSION: NONE
PACKER_VERSION: NONE
GOLANG_VERSION: 1.21.1
GO111MODULE: auto
KUBECTL_VERSION: v1.24.8
MINIKUBE_VERSION: v1.28.0
CRI_DOCKERD_VERSION: 0.3.0
KUBECONFIG: /home/circleci/.kube/config
defaults: &defaults
machine:
enabled: true
image: ubuntu-2004:202111-02
<<: *env
install_gruntwork_utils: &install_gruntwork_utils
name: install gruntwork utils
command: |
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/main/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}"
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
gruntwork-install --module-name "kubernetes-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
gruntwork-install --binary-name "terratest_log_parser" --repo "https://github.com/gruntwork-io/terratest" --tag "${TERRATEST_LOG_PARSER_VERSION}"
configure-environment-for-gruntwork-module \
--mise-version NONE \
--terraform-version ${TERRAFORM_VERSION} \
--terragrunt-version ${TERRAGRUNT_VERSION} \
--packer-version ${PACKER_VERSION} \
--go-version ${GOLANG_VERSION} \
--kubectl-version NONE # We install kubectl in the minikube step
orbs:
go: circleci/go@1.7.3
version: 2.1
jobs:
kubergrunt_tests:
<<: *defaults
steps:
- checkout
- run:
<<: *install_gruntwork_utils
- run:
command: |
cd /home/circleci
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y conntrack wget
setup-minikube --minikube-version "${MINIKUBE_VERSION}" --k8s-version "${KUBECTL_VERSION}" --cri-dockerd-version "${CRI_DOCKERD_VERSION}"
- run:
name: run kubergrunt tests
command: |
mkdir -p /tmp/logs
run-go-tests --path . --timeout 10m | tee /tmp/logs/all.log
no_output_timeout: 900s
- run:
command: terratest_log_parser --testlog /tmp/logs/all.log --outputdir /tmp/logs
when: always
- store_artifacts:
path: /tmp/logs
- store_test_results:
path: /tmp/logs
build:
resource_class: large
<<: *defaults
steps:
- checkout
- run:
<<: *install_gruntwork_utils
- run: build-go-binaries --app-name kubergrunt --src-path ./cmd --dest-path ./bin --ld-flags "-X main.VERSION=$CIRCLE_TAG -extldflags '-static'"
- persist_to_workspace:
root: .
paths: bin
deploy:
<<: *env
macos:
xcode: 14.2.0
resource_class: macos.x86.medium.gen2
steps:
- checkout
- attach_workspace:
at: .
- go/install:
version: "1.20.5"
- run:
name: Install sign-binary-helpers
command: |
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}"
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
gruntwork-install --module-name "sign-binary-helpers" --repo "https://github.com/gruntwork-io/terraform-aws-ci" --tag "${MODULE_CI_VERSION}"
- run:
name: Compile and sign the binaries
command: |
export AC_PASSWORD=${MACOS_AC_PASSWORD}
export AC_PROVIDER=${MACOS_AC_PROVIDER}
sign-binary --install-macos-sign-dependencies --os mac .gon_amd64.hcl
sign-binary --os mac .gon_arm64.hcl
echo "Done signing the binary"
# Replace the files in bin. These are the same file names generated from .gon_amd64.hcl and .gon_arm64.hcl
unzip kubergrunt_darwin_amd64.zip
mv kubergrunt_darwin_amd64 bin/
unzip kubergrunt_darwin_arm64.zip
mv kubergrunt_darwin_arm64 bin/
- run:
name: Run SHA256SUM
command: |
brew install coreutils
cd bin && sha256sum * > SHA256SUMS
- run: upload-github-release-assets bin/*
workflows:
version: 2
test-and-deploy:
jobs:
- kubergrunt_tests:
filters:
tags:
only: /^v.*/
context:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- build:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
context:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- deploy:
requires:
- build
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
context:
- AWS__PHXDEVOPS__circle-ci-test
- GITHUB__PAT__gruntwork-ci
- APPLE__OSX__code-signing