I have mutiple stages in docker. I am using both rolling update and deployement. currently if nothing is deployed I have to do deploy manually and every time I update rolling update will be run by itself.
I want to automate everything. I want to write some condition to check if there is existing replication controller then run rolling update else run deploy. I tried to put if statements in scripts in both deploy or rollout update.
- >
if rancher --debug kubectl rollout status deployment $CI_PROJECT_NAME; then
exit 0
fi
unfortunately I got error:
ERROR: Job failed (system failure): secrets "runner-yx1bv22m-project-122-concurrent-0vrbdb" is forbidden: exceeded quota: default-467s2, requested: secrets=1, used: secrets=20, limited: secrets=20
from what I understand I can't run both jobs at once. what Is the right way to achieve either deployment or rolling update depending on current deployment status?
Basically I got rid of second job. I do everything in single job now.
script:
other scripts
- CHECK_DEPLOYMENT=$(rancher --debug kubectl --insecure-skip-tls-verify get deployments -n $CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG | grep $CI_PROJECT_NAME | awk '{print $1}')
- >
if [ "$CHECK_DEPLOYMENT" == "$CI_PROJECT_NAME" ]; then
do rollup script
else
do deploy script
fi
both deployment or rollup is done by adding single if statement. depending on deployment it will do either roll up or it will deploy.