Skip to content

Commit

Permalink
cleanup script output
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnrobinson committed Dec 14, 2021
1 parent 1783898 commit 15436c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 14 additions & 1 deletion tekton/overlays/secrets/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,24 @@
ssh = [{"k": k, "v": v} for k, v in ssh.items()]
docker = [{"k": k, "v": v} for k, v in docker.items()]

print('Writing secrets to Kustomize...')
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

print(bcolors.OKCYAN + "Writing secrets to Kustomize..." + bcolors.ENDC)

original_stdout = sys.stdout

with open('kustomization.yaml', 'w') as f:
sys.stdout = f
print(pystache.render(input, {"literals": literals, "ssh": ssh, "docker": docker}))
sys.stdout = original_stdout

print(bcolors.OKCYAN + "Completed..." + bcolors.ENDC)
7 changes: 4 additions & 3 deletions tekton/tekton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function secrets(){
pip install -r ${DIR}/overlays/secrets/requirements.txt --exists-action i --quiet
python ${DIR}/overlays/secrets/main.py

echo "${green}Deploying secrets...${normal}"
if [ -z "${CONTEXT}" ]; then

kubectl apply -k overlays/secrets
else
kubectl config use-context ${CONTEXT}
Expand All @@ -39,7 +41,6 @@ function secrets(){
}

function prune(){
setup
kubectl delete pipelinerun $(kubectl get pipelinerun | awk '{print $1}') 2> /dev/null || echo "${green}Pruning completed successfully...${normal}"
}

Expand All @@ -52,8 +53,8 @@ function display_help() {
echo ""
echo "Usage: tekton.sh [option...]" >&2
echo
echo " ${bold}-a, --apply${normal} Apply secrets, pipelines, tasks, and triggers. "
echo " ${bold}-p, --prune${normal} Delete all ${bold}Completed${normal}, $(tput bold)Errored${normal} or $(tput bold)DeadLineExceeded${normal} pod runs. "
echo " ${bold}-a, --apply${normal} Apply ${bold}Secrets${normal}, ${bold}Pipelines${normal}, ${bold}Tasks${normal} and ${bold}Triggers${normal}. "
echo " ${bold}-p, --prune${normal} Delete all ${bold}PipelineRuns${normal}. "
echo " ${bold}-h, --help${normal} Display argument options. "
echo
exit 1
Expand Down

0 comments on commit 15436c5

Please sign in to comment.