-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
176 changed files
with
1,332 additions
and
3,180 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
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,98 @@ | ||
|
||
## Create a new variable setting cluster-name as environment | ||
## If var already exist, just update your value | ||
# Parameters: | ||
# 1 - PROJECT_ID | ||
# 2 - PARAMETER_KEY | ||
# 3 - PARAMETER_VALUE | ||
# 4 - PARAMETER_MASKED | ||
# 5 - ENVIRONMENT_SCOPE | ||
# 6 - GITLAB_TOKEN | ||
createOrUpdateVariable(){ | ||
local PROJECT_ID=$1 | ||
local PARAMETER_KEY=$2 | ||
local PARAMETER_VALUE=$3 | ||
local PARAMETER_MASKED=$4 | ||
local ENVIRONMENT_SCOPE=$5 | ||
local GITLAB_TOKEN=$6 | ||
|
||
# Documentation: https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable | ||
local VARIABLE_RESPONSE_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables" \ | ||
--form "key=$PARAMETER_KEY" --form "value=$PARAMETER_VALUE" --form "masked=$PARAMETER_MASKED" --form "environment_scope=$ENVIRONMENT_SCOPE" | head -n 1 | awk -F' ' '{print $2}') | ||
# echo "VARIABLE_RESPONSE_CODE = $VARIABLE_RESPONSE_CODE" | ||
|
||
if [ $VARIABLE_RESPONSE_CODE = 201 ];then | ||
echoColor yellow "Variable $PARAMETER_KEY created into ${EKS_CLUSTER_NAME} environment" | ||
elif [ $VARIABLE_RESPONSE_CODE = 400 ];then | ||
# echoColor yellow "Variable $PARAMETER_KEY already exists, updating..." | ||
updateVariable $@ | ||
elif [ $VARIABLE_RESPONSE_CODE = 401 ];then | ||
echoColor red "Unauthorized access to GitLab API" | ||
exit 1 | ||
else | ||
echoColor red "Something wrong while saving $PARAMETER_KEY" | ||
fi | ||
|
||
} | ||
|
||
|
||
## Update gitlab variable | ||
# Parameters: | ||
# 1 - PROJECT_ID | ||
# 2 - PARAMETER_KEY | ||
# 3 - PARAMETER_VALUE | ||
# 4 - PARAMETER_MASKED | ||
# 5 - ENVIRONMENT_SCOPE | ||
# 6 - GITLAB_TOKEN | ||
updateVariable(){ | ||
local PROJECT_ID=$1 | ||
local PARAMETER_KEY=$2 | ||
local PARAMETER_VALUE=$3 | ||
local PARAMETER_MASKED=$4 | ||
local ENVIRONMENT_SCOPE=$5 | ||
local GITLAB_TOKEN=$6 | ||
|
||
# Documentation: https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable | ||
local UPDATE_CODE=$(curl -s -i --request PUT --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/variables/${PARAMETER_KEY}?filter\[environment_scope\]=${ENVIRONMENT_SCOPE}" \ | ||
--form "value=$PARAMETER_VALUE" --form "masked=$PARAMETER_MASKED" | head -n 1 | awk -F' ' '{print $2}') | ||
# echo "UPDATE_CODE= $UPDATE_CODE" | ||
if [ $UPDATE_CODE = 200 ];then | ||
echoColor green "$PARAMETER_KEY updated" | ||
else | ||
echoColor red "error while updating $PARAMETER_KEY, $UPDATE_CODE" | ||
fi | ||
} | ||
|
||
|
||
## Create a new branch using eks-cluster-name as branch's name, or just start a new pipeline | ||
# Parameters: | ||
# 1 - PROJECT_ID | ||
# 2 - BRANCH_NAME | ||
# 3 - GITLAB_TOKEN | ||
createBranch(){ | ||
local PROJECT_ID=$1 | ||
local BRANCH_NAME=$2 | ||
local GITLAB_TOKEN=$3 | ||
|
||
echoColor green "Creating branch named $BRANCH_NAME or justing starting a new pipeline" | ||
# echo "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$1&ref=master" | ||
|
||
# Documentation: https://docs.gitlab.com/ee/api/branches.html#create-repository-branch | ||
local CREATE_BRANCH_CODE=$(curl -s -i --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/repository/branches?branch=$BRANCH_NAME&ref=master" | head -n 1 | awk -F' ' '{print $2}') | ||
# echo "CREATE_BRANCH_CODE: $CREATE_BRANCH_CODE" | ||
|
||
if [ $CREATE_BRANCH_CODE = 400 ];then | ||
createPipeline $@ | ||
fi | ||
} | ||
|
||
## create a new pipeline | ||
createPipeline(){ | ||
local PROJECT_ID=$1 | ||
local BRANCH_NAME=$2 | ||
local GITLAB_TOKEN=$3 | ||
# Documentation: https://docs.gitlab.com/ee/api/pipelines.html#create-a-new-pipeline | ||
local RESPONSE_PIPE=$(curl -s --request POST --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" "https://gitlab.com/api/v4/projects/${PROJECT_ID}/pipeline?ref=$BRANCH_NAME") | ||
# echo "RESPONSE_PIPE: $RESPONSE_PIPE" | ||
echoColor green "Pipeline url: $(echo $RESPONSE_PIPE | $VKPR_JQ -r '.web_url')" | ||
} |
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
File renamed without changes.
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
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,16 @@ | ||
#!/bin/bash | ||
|
||
VKPR_HOME=~/.vkpr | ||
VKPR_GLOBAL=$CURRENT_PWD/vkpr.yaml | ||
VKPR_CONFIG=$VKPR_HOME/config | ||
|
||
##ALL RESOURCES EXCEPT CERT-MANAGER MUST BE UNDER THIS NAMESPACE | ||
VKPR_K8S_NAMESPACE=vkpr | ||
|
||
VKPR_GLAB=$VKPR_HOME/bin/glab | ||
VKPR_K3D=$VKPR_HOME/bin/k3d | ||
VKPR_ARKADE=$VKPR_HOME/bin/arkade | ||
VKPR_KUBECTL=$VKPR_HOME/bin/kubectl | ||
VKPR_HELM=$VKPR_HOME/bin/helm | ||
VKPR_JQ=$VKPR_HOME/bin/jq | ||
VKPR_YQ=$VKPR_HOME/bin/yq |
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,15 @@ | ||
#!/bin/bash | ||
|
||
VKPR_EXTERNAL_DNS_VERSION="5.4.9" | ||
VKPR_WHOAMI_VERSION="2.5.0" | ||
VKPR_KEYCLOAK_VERSION="6.1.2" | ||
VKPR_LOKI_VERSION="2.5.0" | ||
VKPR_PROMETHEUS_STACK_VERSION="23.1.1" | ||
VKPR_POSTGRES_VERSION="8.2.5" | ||
VKPR_INGRESS_NGINX_VERSION="4.0.13" | ||
VKPR_CERT_VERSION="v1.5.3" | ||
VKPR_KONG_VERSION="2.6.4" | ||
VKPR_CONSUL_VERSION="0.38.0" | ||
VKPR_VAULT_VERSION="0.18.0" | ||
VKPR_ARGOCD_VERSION="3.29.4" | ||
VKPR_ARGOCD_ADDON_APPLICATIONSET_VERSION="1.9.1" |
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 |
---|---|---|
@@ -1,15 +1,13 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
BIN_FOLDER=bin | ||
BINARY_NAME_UNIX=run.sh | ||
ENTRY_POINT_UNIX=main.sh | ||
LIB_RESOURCES="../../lib/functions/*" | ||
|
||
#bash-build: | ||
mkdir -p $BIN_FOLDER | ||
mkdir -p $BIN_FOLDER/src | ||
cp $LIB_RESOURCES $BIN_FOLDER/src | ||
cp -r src/* $BIN_FOLDER | ||
mv $BIN_FOLDER/$ENTRY_POINT_UNIX $BIN_FOLDER/$BINARY_NAME_UNIX | ||
chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX | ||
|
||
#bat-build: | ||
|
||
#docker: | ||
chmod +x $BIN_FOLDER/$BINARY_NAME_UNIX |
Oops, something went wrong.