Skip to content

Commit d33dd6c

Browse files
authored
Merge pull request #99 from kbst/testcredentials
Testcredentials
2 parents 1c39773 + deaed67 commit d33dd6c

File tree

5 files changed

+62
-5
lines changed

5 files changed

+62
-5
lines changed

cloudbuild-cleanup.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
substitutions:
22
_HOME: /workspace/tests/.user
33
_TF_IN_AUTOMATION: "1"
4+
_KBST_AUTH_AWS: ""
5+
_KBST_AUTH_AZ: ""
6+
_KBST_AUTH_GCLOUD: ""
47

58
steps:
69
- id: docker build
@@ -12,6 +15,16 @@ steps:
1215
- kbst-infra-automation:bootstrap
1316
- ci-cd/
1417

18+
- id: authenticate
19+
name: 'kbst-infra-automation:bootstrap'
20+
dir: tests
21+
env:
22+
- HOME=$_HOME
23+
- TF_IN_AUTOMATION=$_TF_IN_AUTOMATION
24+
- KBST_AUTH_AWS=$_KBST_AUTH_AWS
25+
- KBST_AUTH_AZ=$_KBST_AUTH_AZ
26+
- KBST_AUTH_GCLOUD=$_KBST_AUTH_GCLOUD
27+
1528
- id: terraform init
1629
name: 'kbst-infra-automation:bootstrap'
1730
dir: tests

cloudbuild-graph.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
substitutions:
22
_HOME: /workspace/tests/.user
33
_TF_IN_AUTOMATION: "1"
4+
_KBST_AUTH_AWS: ""
5+
_KBST_AUTH_AZ: ""
6+
_KBST_AUTH_GCLOUD: ""
47

58
steps:
69
- id: docker build
@@ -12,6 +15,16 @@ steps:
1215
- kbst-infra-automation:bootstrap
1316
- ci-cd/
1417

18+
- id: authenticate
19+
name: 'kbst-infra-automation:bootstrap'
20+
dir: tests
21+
env:
22+
- HOME=$_HOME
23+
- TF_IN_AUTOMATION=$_TF_IN_AUTOMATION
24+
- KBST_AUTH_AWS=$_KBST_AUTH_AWS
25+
- KBST_AUTH_AZ=$_KBST_AUTH_AZ
26+
- KBST_AUTH_GCLOUD=$_KBST_AUTH_GCLOUD
27+
1528
- id: terraform init
1629
name: 'kbst-infra-automation:bootstrap'
1730
dir: tests

cloudbuild-providers.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
substitutions:
22
_HOME: /workspace/tests/.user
33
_TF_IN_AUTOMATION: "1"
4+
_KBST_AUTH_AWS: ""
5+
_KBST_AUTH_AZ: ""
6+
_KBST_AUTH_GCLOUD: ""
47

58
steps:
69
- id: docker build
@@ -12,6 +15,16 @@ steps:
1215
- kbst-infra-automation:bootstrap
1316
- ci-cd/
1417

18+
- id: authenticate
19+
name: 'kbst-infra-automation:bootstrap'
20+
dir: tests
21+
env:
22+
- HOME=$_HOME
23+
- TF_IN_AUTOMATION=$_TF_IN_AUTOMATION
24+
- KBST_AUTH_AWS=$_KBST_AUTH_AWS
25+
- KBST_AUTH_AZ=$_KBST_AUTH_AZ
26+
- KBST_AUTH_GCLOUD=$_KBST_AUTH_GCLOUD
27+
1528
- id: terraform init
1629
name: 'kbst-infra-automation:bootstrap'
1730
dir: tests

cloudbuild-test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
substitutions:
22
_HOME: /workspace/tests/.user
33
_TF_IN_AUTOMATION: "1"
4+
_KBST_AUTH_AWS: ""
5+
_KBST_AUTH_AZ: ""
6+
_KBST_AUTH_GCLOUD: ""
47

58
steps:
69
- id: docker build
@@ -12,12 +15,23 @@ steps:
1215
- kbst-infra-automation:bootstrap
1316
- ci-cd/
1417

18+
- id: authenticate
19+
name: 'kbst-infra-automation:bootstrap'
20+
dir: tests
21+
env:
22+
- HOME=$_HOME
23+
- TF_IN_AUTOMATION=$_TF_IN_AUTOMATION
24+
- KBST_AUTH_AWS=$_KBST_AUTH_AWS
25+
- KBST_AUTH_AZ=$_KBST_AUTH_AZ
26+
- KBST_AUTH_GCLOUD=$_KBST_AUTH_GCLOUD
27+
1528
- id: terraform init
1629
name: 'kbst-infra-automation:bootstrap'
1730
dir: tests
1831
env:
1932
- HOME=$_HOME
2033
- TF_IN_AUTOMATION=$_TF_IN_AUTOMATION
34+
- TF_LOG=debug
2135
args:
2236
- terraform
2337
- init

quickstart/src/ci-cd/entrypoint

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#!/bin/sh
22
set -e
33

4-
mkdir -p /infra/.user
4+
# home may be modified from multiple sources
5+
# try to normalize before using it in paths below
6+
REALHOME=$(realpath $HOME)
57

6-
echo "kbst:x:$(id -u):$(id -g):Kubestack User:/infra/.user:/bin/sh" > /tmp/passwd
8+
mkdir -p $REALHOME
9+
10+
echo "kbst:x:$(id -u):$(id -g):Kubestack User:${REALHOME}:/bin/sh" > /tmp/passwd
711

812
export LD_PRELOAD=libnss_wrapper.so
913
export NSS_WRAPPER_PASSWD=/tmp/passwd
@@ -12,7 +16,7 @@ export NSS_WRAPPER_GROUP=/etc/group
1216
#
1317
#
1418
# AWS auth
15-
AWS_CONFIG_PATH=/infra/.user/.aws
19+
AWS_CONFIG_PATH=$REALHOME/.aws
1620
mkdir -p $AWS_CONFIG_PATH
1721

1822
# handle base64 encoded AWS crendentials
@@ -25,7 +29,7 @@ fi
2529
#
2630
#
2731
# Azure auth
28-
AZ_CONFIG_PATH=/infra/.user/.azure
32+
AZ_CONFIG_PATH=$REALHOME/.azure
2933
mkdir -p $AZ_CONFIG_PATH
3034
touch $AZ_CONFIG_PATH/KBST_AUTH_AZ
3135

@@ -49,7 +53,7 @@ export ARM_TENANT_ID
4953
#
5054
#
5155
# Gcloud auth
52-
GCLOUD_CONFIG_PATH=/infra/.user/.config/gcloud
56+
GCLOUD_CONFIG_PATH=$REALHOME/.config/gcloud
5357
mkdir -p $GCLOUD_CONFIG_PATH
5458

5559
# handle base64 encoded GCLOUD crendentials

0 commit comments

Comments
 (0)