Skip to content

Commit

Permalink
fix: now using correct condition for deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Forattini committed Jul 28, 2022
1 parent fea94fa commit 7bbe31b
Showing 1 changed file with 25 additions and 30 deletions.
55 changes: 25 additions & 30 deletions .github/workflows/svc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -696,17 +696,17 @@ jobs:

# dependencies
- name: Dependencies | Resources render
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
run: |
ytt \
-f ./.pipeline/deploy/as-k8s/dependencies.schema.yml \
-f ./.pipeline/deploy/as-k8s/dependencies.yml \
-f ./manifests/dependencies/dev.yml \
--data-value repository=${{steps.deploy_setup.outputs.deploy_repository}} \
-f ${{steps.analysis.outputs.deploy_dependencies_file}} \
--data-value repository=${{steps.analysis.outputs.deploy_repository}} \
> ./manifests/k8s-dependencies.yml
- name: Docs | Dependencies
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
run: |
echo -e "### Dependencies\n\n" >> $GITHUB_STEP_SUMMARY
echo -e "<details><summary>dependencies</summary>\n\n\`\`\`yml \n$(cat ./manifests/k8s-dependencies.yml)\n \`\`\`\n </details>\n\n" >> $GITHUB_STEP_SUMMARY
Expand All @@ -720,13 +720,13 @@ jobs:
fi
- name: Dependencies | Helm update
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Dependencies | Mysql
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -736,7 +736,7 @@ jobs:
./.pipeline/src/dependency-install.sh
- name: Dependencies | Postgres
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -746,7 +746,7 @@ jobs:
./.pipeline/src/dependency-install.sh
- name: Dependencies | Rabbitmq
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -756,7 +756,7 @@ jobs:
./.pipeline/src/dependency-install.sh
- name: Dependencies | Elasticsearch
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -766,7 +766,7 @@ jobs:
./.pipeline/src/dependency-install.sh
- name: Dependencies | Redis
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -776,7 +776,7 @@ jobs:
./.pipeline/src/dependency-install.sh
- name: Dependencies | Nats
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -786,7 +786,7 @@ jobs:
./.pipeline/src/dependency-install.sh
- name: Dependencies | Etcd
if: steps.deploy_setup.outputs.has_dev_dependencies == 'true'
if: steps.analysis.outputs.feature_has_dependencies == 'true'
continue-on-error: true
run: |
K8S_NAMESPACE=${{steps.analysis.outputs.deploy_namespace}} \
Expand All @@ -805,7 +805,7 @@ jobs:
# secrets
- name: Decrypt DEV secrets
if: steps.deploy_setup.outputs.has_dev_secrets == 'true'
if: steps.analysis.outputs.has_dev_secrets == 'true'
run: |
gpg \
--yes --batch --quiet --decrypt \
Expand All @@ -814,7 +814,7 @@ jobs:
./manifests/secrets/dev.gpg
- name: K8s create secrets
if: steps.deploy_setup.outputs.has_dev_secrets == 'true'
if: steps.analysis.outputs.has_dev_secrets == 'true'
run: |
kubectl create secret generic -n ${{steps.analysis.outputs.deploy_namespace}} ${{steps.analysis.outputs.repository}} --from-env-file=./manifests/k8s-secrets.env --dry-run=client --validate=false --output=yaml | kubectl apply -f -
kubectl create secret generic -n ${{steps.analysis.outputs.deploy_namespace}} ${{steps.analysis.outputs.repository}}-${{steps.versioning.outputs.version}} --from-env-file=./manifests/k8s-secrets.env --dry-run=client --validate=false --output=yaml | kubectl apply -f -
Expand All @@ -830,18 +830,15 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Config | Gives runner access to docker config file
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
run: |
sudo chown $(whoami):docker /home/$(whoami)/.docker/config.json
cp /home/$(whoami)/.docker/config.json ./manifests/docker-config.json
- name: K8s create registry-token secret
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
run: kubectl create secret generic -n ${{steps.analysis.outputs.deploy_namespace}} registry-token --type=kubernetes.io/dockerconfigjson --from-file=.dockerconfigjson=./manifests/docker-config.json --dry-run=client --validate=false --output=yaml | kubectl apply -f -

# generate k8s manifests
- name: K8s generates final yml
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
run: |
CONFIGS_LIST=$(if test -f ./manifests/k8s-configs-keys.txt; then cat ./manifests/k8s-configs-keys.txt; else echo ''; fi)
SECRETS_LIST=$(if test -f ./manifests/k8s-secrets-keys.txt; then cat ./manifests/k8s-secrets-keys.txt; else echo ''; fi)
Expand All @@ -850,21 +847,20 @@ jobs:
-f ./.pipeline/deploy/as-k8s/service.schema.yml \
-f ./.pipeline/deploy/as-k8s/service \
-f ./manifests/k8s-values.yml \
--data-value ecosystem=${{steps.deploy_setup.outputs.deploy_ecosystem}} \
--data-value organization=${{steps.deploy_setup.outputs.deploy_organization}} \
--data-value repository=${{steps.deploy_setup.outputs.deploy_repository}} \
--data-value containerRegistry=${{steps.deploy_setup.outputs.deploy_container_registry}} \
--data-value tag=${{steps.deploy_setup.outputs.deploy_tag}} \
--data-value-yaml deployment.imagePullSecrets=true \
--data-value-yaml envFromSecrets="[$SECRETS_LIST]" \
--data-value-yaml envFromConfigMaps="[$CONFIGS_LIST]" \
--data-value-yaml envFromDependencies="[$DEPENDENCIES_LIST]" \
--data-value pipelineControl.datetime=${{steps.deploy_setup.outputs.run_started_at}} \
--data-value-yaml pipelineControl.environmentsAsNamespaces=${{inputs.environmentsAsNamespaces}} \
--data-value ecosystem=${{steps.analysis.outputs.deploy_ecosystem}} \
--data-value organization=${{steps.analysis.outputs.organization}} \
--data-value repository=${{steps.analysis.outputs.repository}} \
--data-value containerRegistry=${{inputs.containerRegistry}} \
--data-value tag=${{steps.analysis.outputs.deploy_tag}} \
--data-value-yaml deployment.imagePullSecrets=true \
--data-value-yaml envFromSecrets="[$SECRETS_LIST]" \
--data-value-yaml envFromConfigMaps="[$CONFIGS_LIST]" \
--data-value-yaml envFromDependencies="[$DEPENDENCIES_LIST]" \
--data-value pipelineControl.datetime=${{steps.analysis.outputs.run_started_at}} \
--data-value-yaml pipelineControl.environmentsAsNamespaces=${{inputs.environmentsAsNamespaces}} \
> ./manifests/k8s-to-apply.yml
- name: Docs | K8s summary
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
run: |
CONFIGS_LIST=$(if test -f ./manifests/k8s-configs-keys.txt; then cat ./manifests/k8s-configs-keys.txt; else echo ''; fi)
SECRETS_LIST=$(if test -f ./manifests/k8s-secrets-keys.txt; then cat ./manifests/k8s-secrets-keys.txt; else echo ''; fi)
Expand All @@ -878,7 +874,6 @@ jobs:
echo -e "<details><summary>kubefile</summary>\n\n\`\`\`yml \n$(cat ./manifests/k8s-to-apply.yml)\n \`\`\`\n </details>\n\n" >> $GITHUB_STEP_SUMMARY
- name: K8s apply yml
if: steps.deploy_setup.outputs.deploy_as_k8s == 'true'
run: |
kubectl apply -f ./manifests/k8s-to-apply.yml
kubectl get pods -n ${{steps.analysis.outputs.deploy_namespace}}

0 comments on commit 7bbe31b

Please sign in to comment.