Skip to content

Commit 882a1f6

Browse files
committed
test
1 parent 0c42971 commit 882a1f6

9 files changed

Lines changed: 53 additions & 50 deletions

File tree

.tasks/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
54
DEPLOYMENT_ID: '{{.DEPLOYMENT_ID | default "devex-cicd"}}'
65

76
env:
8-
ANSIBLE_COLLECTIONS_PATH: "{{.ARTIFACT_DIR}}/collections"
9-
ANSIBLE_ROLES_PATH: "{{.ARTIFACT_DIR}}/roles"
7+
ANSIBLE_COLLECTIONS_PATH: "{{.ANSIBLE_COLLECTIONS_PATH}}"
8+
ANSIBLE_ROLES_PATH: "{{.ANSIBLE_ROLES_PATH}}"
109

1110
tasks:
1211
default:

.tasks/cloud.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ vars:
88
ALLOW_FORCE_DESTROY: '{{.ALLOW_FORCE_DESTROY | default "true"}}'
99
VPC_ID: '{{.VPC_ID | default ""}}'
1010
DISTRO: '{{.DISTRO | default "ubuntu-focal"}}'
11-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
1211
PUBLIC_KEY: "{{.ARTIFACT_DIR}}/testkey.pub"
1312
ANSIBLE_INVENTORY: "{{.ARTIFACT_DIR}}/hosts_{{.DEPLOYMENT_ID}}.ini"
1413
MACHINE_ARCH: '{{.MACHINE_ARCH | default "x86_64"}}'

.tasks/console.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
54
DEPLOYMENT_ID: '{{.DEPLOYMENT_ID | default "devex-cicd"}}'
65
PRIVATE_KEY: "{{.ARTIFACT_DIR}}/testkey"
76
ANSIBLE_INVENTORY: "{{.ARTIFACT_DIR}}/hosts_{{.DEPLOYMENT_ID}}.ini"
@@ -11,8 +10,8 @@ env:
1110
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES"
1211
ANSIBLE_LOG_PATH: "{{.ARTIFACT_DIR}}/logs/{{.DEPLOYMENT_ID}}.log"
1312
ANSIBLE_INVENTORY: "{{.ANSIBLE_INVENTORY}}"
14-
ANSIBLE_COLLECTIONS_PATH: "{{.ARTIFACT_DIR}}/collections"
15-
ANSIBLE_ROLES_PATH: "{{.ARTIFACT_DIR}}/roles"
13+
ANSIBLE_COLLECTIONS_PATH: "{{.ANSIBLE_COLLECTIONS_PATH}}"
14+
ANSIBLE_ROLES_PATH: "{{.ANSIBLE_ROLES_PATH}}"
1615

1716
tasks:
1817
default:

.tasks/mirror.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
54
DEPLOYMENT_ID: '{{.DEPLOYMENT_ID | default "devex-cicd"}}'
65
NUM_NODES: '{{.NUM_NODES | default "3"}}'
76
ENABLE_MONITORING: '{{.ENABLE_MONITORING | default "true"}}'

.tasks/monitor.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
54
DEPLOYMENT_ID: '{{.DEPLOYMENT_ID | default "devex-cicd"}}'
65
PRIVATE_KEY: "{{.ARTIFACT_DIR}}/testkey"
76
ANSIBLE_INVENTORY: "{{.ARTIFACT_DIR}}/hosts_{{.DEPLOYMENT_ID}}.ini"
@@ -12,8 +11,8 @@ env:
1211
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES"
1312
ANSIBLE_LOG_PATH: "{{.ARTIFACT_DIR}}/logs/{{.DEPLOYMENT_ID}}.log"
1413
ANSIBLE_INVENTORY: "{{.ANSIBLE_INVENTORY}}"
15-
ANSIBLE_COLLECTIONS_PATH: "{{.ARTIFACT_DIR}}/collections"
16-
ANSIBLE_ROLES_PATH: "{{.ARTIFACT_DIR}}/roles"
14+
ANSIBLE_COLLECTIONS_PATH: "{{.ANSIBLE_COLLECTIONS_PATH}}"
15+
ANSIBLE_ROLES_PATH: "{{.ANSIBLE_ROLES_PATH}}"
1716

1817
tasks:
1918
default:

.tasks/redpanda.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
54
DEPLOYMENT_ID: '{{.DEPLOYMENT_ID | default "devex-cicd"}}'
65
PRIVATE_KEY: "{{.ARTIFACT_DIR}}/testkey"
76
ANSIBLE_INVENTORY: "{{.ARTIFACT_DIR}}/hosts_{{.DEPLOYMENT_ID}}.ini"
@@ -16,8 +15,8 @@ env:
1615
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES"
1716
ANSIBLE_LOG_PATH: "{{.ARTIFACT_DIR}}/logs/{{.DEPLOYMENT_ID}}.log"
1817
ANSIBLE_INVENTORY: "{{.ANSIBLE_INVENTORY}}"
19-
ANSIBLE_COLLECTIONS_PATH: "{{.ARTIFACT_DIR}}/collections"
20-
ANSIBLE_ROLES_PATH: "{{.ARTIFACT_DIR}}/roles"
18+
ANSIBLE_COLLECTIONS_PATH: "{{.ANSIBLE_COLLECTIONS_PATH}}"
19+
ANSIBLE_ROLES_PATH: "{{.ANSIBLE_ROLES_PATH}}"
2120

2221
tasks:
2322
default:

.tasks/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
54
DEPLOYMENT_ID: '{{.DEPLOYMENT_ID | default "devex-cicd"}}'
65
RPK_PATH: "{{.ARTIFACT_DIR}}/bin/rpk"
76
HOSTS_FILE: "{{.ARTIFACT_DIR}}/hosts_{{.DEPLOYMENT_ID}}.ini"
87
TEST_TOPIC_NAME: '{{.TEST_TOPIC_NAME | default "testtopic"}}'
98
PARTITION_COUNT: '{{.PARTITION_COUNT | default "3"}}'
109
CA_CRT:
11-
sh: echo "${CA_CRT:-{{.PWD}}/ansible/tls/ca/ca.crt}"
10+
sh: echo "${CA_CRT:-{{.ROOT_DIR}}/ansible/tls/ca/ca.crt}"
1211
AWS_DEFAULT_REGION: '{{.AWS_DEFAULT_REGION | default "us-west-2"}}'
1312
BUCKET_NAME:
1413
sh: echo "$(echo {{.DEPLOYMENT_ID}} | sed 's/_/-/g')-bucket"

.tasks/tools.yml

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
version: '3'
22

33
vars:
4-
ARTIFACT_DIR: "{{.PWD}}/artifacts"
5-
ANSIBLE_COLLECTIONS_PATH: "{{.ARTIFACT_DIR}}/collections"
6-
ANSIBLE_ROLES_PATH: "{{.ARTIFACT_DIR}}/roles"
7-
MAC_RPK: "https://github.com/redpanda-data/redpanda/releases/latest/download/rpk-darwin-amd64.zip"
8-
LINUX_RPK: "https://github.com/redpanda-data/redpanda/releases/latest/download/rpk-linux-amd64.zip"
9-
SSH_EMAIL: '{{.SSH_EMAIL | default "test@test.com"}}'
104
CLIENT_NAME: '{{.CLIENT_NAME | default "client"}}'
11-
CLIENT_DIR: "{{.PWD}}/ansible/tls/clients"
12-
CA_DIR: "{{.PWD}}/ansible/tls/ca"
13-
CERT_DIR: "{{.PWD}}/ansible/tls/certs"
5+
CLIENT_DIR: "{{.ROOT_DIR}}/ansible/tls/clients"
6+
CA_DIR: "{{.ROOT_DIR}}/ansible/tls/ca"
7+
CERT_DIR: "{{.ROOT_DIR}}/ansible/tls/certs"
148

159
tasks:
1610
default:
@@ -30,23 +24,32 @@ tasks:
3024
_ansible-collections:
3125
internal: true
3226
desc: "Install Ansible collections from requirements.yml"
27+
sources:
28+
- "{{.ROOT_DIR}}/requirements.yml"
29+
generates:
30+
- "{{.ANSIBLE_COLLECTIONS_PATH}}/ansible_collections"
3331
cmds:
3432
- mkdir -p {{.ANSIBLE_COLLECTIONS_PATH}}
35-
- ansible-galaxy collection install -r {{.PWD}}/requirements.yml --force -p {{.ANSIBLE_COLLECTIONS_PATH}}
36-
status:
37-
- test -d {{.ANSIBLE_COLLECTIONS_PATH}}/ansible_collections
33+
- ansible-galaxy collection install -r {{.ROOT_DIR}}/requirements.yml --force -p {{.ANSIBLE_COLLECTIONS_PATH}}
3834

3935
_ansible-roles:
4036
internal: true
4137
desc: "Install Ansible roles from requirements.yml"
38+
sources:
39+
- "{{.ROOT_DIR}}/requirements.yml"
40+
generates:
41+
- "{{.ANSIBLE_ROLES_PATH}}"
4242
cmds:
4343
- mkdir -p {{.ANSIBLE_ROLES_PATH}}
44-
- ansible-galaxy role install -r {{.PWD}}/requirements.yml --force -p {{.ANSIBLE_ROLES_PATH}}
45-
status:
46-
- test -d {{.ANSIBLE_ROLES_PATH}}
44+
- ansible-galaxy role install -r {{.ROOT_DIR}}/requirements.yml --force -p {{.ANSIBLE_ROLES_PATH}}
4745

4846
rpk:
4947
desc: "Install rpk CLI tool"
48+
vars:
49+
MAC_RPK: "https://github.com/redpanda-data/redpanda/releases/latest/download/rpk-darwin-amd64.zip"
50+
LINUX_RPK: "https://github.com/redpanda-data/redpanda/releases/latest/download/rpk-linux-amd64.zip"
51+
generates:
52+
- "{{.ARTIFACT_DIR}}/bin/rpk"
5053
cmds:
5154
- mkdir -p {{.ARTIFACT_DIR}}/tmp
5255
- mkdir -p {{.ARTIFACT_DIR}}/bin
@@ -61,21 +64,17 @@ tasks:
6164
- chmod 755 {{.ARTIFACT_DIR}}/bin/rpk
6265
- rm {{.ARTIFACT_DIR}}/tmp/rpk.zip
6366
- echo "rpk installed to {{.ARTIFACT_DIR}}/bin/rpk"
64-
status:
65-
- test -f {{.ARTIFACT_DIR}}/bin/rpk
6667

6768
ssh-keys:
6869
desc: "Generate SSH keypair for deployment"
70+
vars:
71+
SSH_EMAIL: '{{.SSH_EMAIL | default "test@test.com"}}'
72+
generates:
73+
- "{{.ARTIFACT_DIR}}/testkey"
74+
- "{{.ARTIFACT_DIR}}/testkey.pub"
6975
cmds:
70-
- |
71-
if [ ! -f artifacts/testkey ]; then
72-
printf 'y\n' | ssh-keygen -t rsa -b 4096 -C "{{.SSH_EMAIL}}" -N "" -f artifacts/testkey && chmod 0700 artifacts/testkey
73-
echo "SSH keypair generated"
74-
else
75-
echo "SSH keypair already exists"
76-
fi
77-
status:
78-
- test -f artifacts/testkey
76+
- printf 'y\n' | ssh-keygen -t rsa -b 4096 -C "{{.SSH_EMAIL}}" -N "" -f {{.ARTIFACT_DIR}}/testkey && chmod 0700 {{.ARTIFACT_DIR}}/testkey
77+
- echo "SSH keypair generated"
7978

8079
tls-certs:
8180
desc: "Generate client TLS certificates"
@@ -88,31 +87,37 @@ tasks:
8887

8988
_cert-client-dir:
9089
internal: true
90+
generates:
91+
- "{{.CLIENT_DIR}}"
9192
cmds:
9293
- mkdir -p {{.CLIENT_DIR}}
93-
status:
94-
- test -d {{.CLIENT_DIR}}
9594

9695
_cert-client-key:
9796
internal: true
97+
generates:
98+
- "{{.CLIENT_DIR}}/{{.CLIENT_NAME}}.key"
9899
cmds:
99100
- openssl genrsa -out {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.key 2048
100-
status:
101-
- test -f {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.key
102101

103102
_cert-client-csr:
104103
internal: true
104+
sources:
105+
- "{{.CLIENT_DIR}}/{{.CLIENT_NAME}}.key"
106+
generates:
107+
- "{{.CLIENT_DIR}}/{{.CLIENT_NAME}}.csr"
105108
cmds:
106109
- openssl req -new -key {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.key -out {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.csr -subj "/CN={{.CLIENT_NAME}}"
107-
status:
108-
- test -f {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.csr
109110

110111
_cert-client-crt:
111112
internal: true
113+
sources:
114+
- "{{.CLIENT_DIR}}/{{.CLIENT_NAME}}.csr"
115+
- "{{.CA_DIR}}/ca.crt"
116+
- "{{.CA_DIR}}/ca.key"
117+
generates:
118+
- "{{.CLIENT_DIR}}/{{.CLIENT_NAME}}.crt"
112119
cmds:
113120
- openssl x509 -req -in {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.csr -CA {{.CA_DIR}}/ca.crt -CAkey {{.CA_DIR}}/ca.key -CAcreateserial -out {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.crt -days 365 -sha256
114-
status:
115-
- test -f {{.CLIENT_DIR}}/{{.CLIENT_NAME}}.crt
116121

117122
clean-certs:
118123
desc: "Remove all TLS certificates"

Taskfile.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ version: '3'
33

44
dotenv: ['.env']
55

6+
vars:
7+
ARTIFACT_DIR: "{{.ROOT_DIR}}/artifacts"
8+
ANSIBLE_COLLECTIONS_PATH: "{{.ARTIFACT_DIR}}/collections"
9+
ANSIBLE_ROLES_PATH: "{{.ARTIFACT_DIR}}/roles"
10+
611
includes:
712
tools: .tasks/tools.yml
813
cloud: .tasks/cloud.yml

0 commit comments

Comments
 (0)