-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci-automation): Introduce new Gen3 CLI cmds to mutate k8s confi…
…gmaps (#1621) * chore(ci-automation): Introduce new Gen3 CLI cmds to mutate k8s configmaps * add comments Co-authored-by: Atharva Rane <[email protected]>
- Loading branch information
1 parent
07980fe
commit fda0430
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
source "${GEN3_HOME}/gen3/lib/utils.sh" | ||
gen3_load "gen3/gen3setup" | ||
|
||
set -xe | ||
|
||
# script for mutating the ETLMapping.yaml on jenkins env | ||
# the incoming PR environment's ETLMapping.yaml is mutated to Jenkins environment | ||
|
||
# how it is executed? | ||
# gen3 mutate-etl-mapping-config {PR} {repoName} | ||
|
||
echo "hello world" | ||
|
||
prNumber=$1 | ||
repoName=$2 | ||
|
||
kubectl get cm etl-mapping -o jsonpath='{.data.etlMapping\.yaml}' > etlMapping.yaml | ||
sed -i 's/.*name: \(.*\)_subject$/ name: '"${prNumber}"'.'"${repoName}"'.\1_subject/' etlMapping.yaml | ||
sed -i 's/.*name: \(.*\)_etl$/ name: '"${prNumber}"'.'"${repoName}"'.\1_etl/' etlMapping.yaml | ||
sed -i 's/.*name: \(.*\)_file$/ name: '"${prNumber}"'.'"${repoName}"'.\1_file/' etlMapping.yaml | ||
kubectl delete configmap etl-mapping | ||
kubectl create configmap etl-mapping --from-file=etlMapping.yaml=etlMapping.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
source "${GEN3_HOME}/gen3/lib/utils.sh" | ||
gen3_load "gen3/gen3setup" | ||
|
||
set -xe | ||
|
||
# script for mutating the guppy configuration on jenkins env | ||
# the incoming PR's guppy configuration is mutated to Jenkins environment | ||
|
||
# how it is executed? | ||
# gen3 mutate-guppy-config {PR} {repoName} | ||
|
||
prNumber=$1 | ||
repoName=$2 | ||
|
||
kubectl get configmap manifest-guppy -o yaml > original_guppy_config.yaml | ||
sed -i 's/\(.*\)"index": "\(.*\)_subject",$/\1"index": "'"${prNumber}"'.'"${repoName}"'.\2_subject",/' original_guppy_config.yaml | ||
sed -i 's/\(.*\)"index": "\(.*\)_etl",$/\1"index": "'"${prNumber}"'.'"${repoName}"'.\2_etl",/' original_guppy_config.yaml | ||
sed -i 's/\(.*\)"index": "\(.*\)_file",$/\1"index": "'"${prNumber}"'.'"${repoName}"'.\2_file",/' original_guppy_config.yaml | ||
sed -i 's/\(.*\)"config_index": "\(.*\)_array-config",$/\1"config_index": "'"${prNumber}"'.'"${repoName}"'.\2_array-config",/' original_guppy_config.yaml | ||
kubectl delete configmap manifest-guppy | ||
kubectl apply -f original_guppy_config.yaml | ||
gen3 roll guppy |