IMAGE_GITGUARDIAN: gitguardian/ggshield:latest
IMAGE_SONAR: sonarsource/sonar-scanner-cli:latest
IMAGE_OKTETO: okteto/okteto:1.13.4
IMAGE_CYPRESS: cypress/browsers:node18.12.0-chrome107
IMAGE_DOCKER: docker:stable
IMAGE_KANIKO: gcr.io/kaniko-project/executor:v1.9.0-debug
IMAGE_TRIVY: docker.io/aquasec/trivy:latest
key: ${CI_COMMIT_REF_SLUG}
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'devops'
- if: $CI_COMMIT_BRANCH != 'devops'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'devops'
- if: $CI_COMMIT_BRANCH != 'devops'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_COMMIT_BRANCH != 'devops'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'devops'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'devops'
- if: $CI_COMMIT_BRANCH != 'devops'
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_COMMIT_BRANCH != 'devops'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'devops'
- if: $CI_COMMIT_BRANCH == 'devops' && $RELEASE == 'yes'
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main'
- if: $CI_COMMIT_BRANCH == 'devops' && $RELEASE == 'yes'
- if: $CI_COMMIT_BRANCH != 'main'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main'
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main'
- if: $CI_COMMIT_BRANCH == 'main'
- export KUBECONFIG=${ENV_KUBECONFIG}:${KUBECONFIG:-$HOME/.kube/config}
- sed -i 's/_CI_PROJECT_TITLE/'"${CI_PROJECT_TITLE}"'/' "charts/templates/NOTES.txt"
- sed -i 's/_VA_ENV/'""'/' "charts/templates/NOTES.txt"
- sed -i 's/_CI_COMMIT_REF_SLUG/'""'/' "charts/templates/NOTES.txt"
- sed -i 's/_OKTETO_USERNAME/'"-${OKTETO_USERNAME}"'/' "charts/templates/NOTES.txt"
- helm upgrade $CI_PROJECT_NAME ./charts
--values=./charts/values.yaml
--namespace ${VA_ENV}-${OKTETO_USERNAME}
- docker run -v $PWD/charts:/dir -v $PWD/lint/config.yaml:/etc/config.yaml stackrox/kube-linter lint /dir --config /etc/config.yaml
- !reference [.charts_rules, rules]
- !reference [.devops_rules, rules]
SONAR_USER_HOME: '${CI_PROJECT_DIR}/.sonar'
- !reference [.code_rules, rules]
- !reference [.devops_rules, rules]
- npm run integration-testing &
- npx cypress run --env baseUrl=http://localhost:3000 --config-file cypress/integration-testing.config.ts --browser chrome --reporter junit --reporter-options "mochaFile=results/test-integration-[hash].xml"
- results/test-integration-*.xml
- cypress/videos/**/*.mp4
- cypress/screenshots/**/*.png
junit: results/test-integration-*.xml
- !reference [.tests_rules, rules]
- !reference [.devops_rules, rules]
- ggshield secret scan ci
- !reference [.code_rules, rules]
- !reference [.tests_rules, rules]
- !reference [.devops_rules, rules]
- trivy conf --severity HIGH,CRITICAL .
name: 'gl-type-detection-report-${CI_BUILD_ID}-${CI_COMMIT_SHA}.json'
- !reference [.code_rules, rules]
- !reference [.devops_rules, rules]
- okteto preview deploy $VA_ENV-$CI_COMMIT_REF_SLUG-$OKTETO_USERNAME --scope personal --branch $CI_COMMIT_REF_NAME --repository $CI_REPOSITORY_URL --wait
name: review/$CI_COMMIT_REF_SLUG
url: https://${CI_PROJECT_TITLE}-${VA_ENV}-${CI_COMMIT_REF_SLUG}-${OKTETO_USERNAME}.cloud.okteto.net
- !reference [.code_rules, rules]
- !reference [.tests_rules, rules]
- npx cypress run --env baseUrl=https://${CI_PROJECT_TITLE}-${VA_ENV}-${CI_COMMIT_REF_SLUG}-${OKTETO_USERNAME}.cloud.okteto.net --config-file cypress/e2e.config.ts --browser chrome --reporter junit --reporter-options "mochaFile=results/test-e2e-[hash].xml"
- cypress/videos/**/*.mp4
- cypress/screenshots/**/*.png
junit: results/test-e2e-*.xml
- !reference [.code_rules, rules]
- !reference [.tests_rules, rules]
name: review/$CI_COMMIT_REF_SLUG
- okteto preview destroy $VA_ENV-$CI_COMMIT_REF_SLUG-$OKTETO_USERNAME
- !reference [.code_rules_stop, rules]
- !reference [.tests_rules_stop, rules]
DOCKER_HUB_IMAGE: app-okteto
REGISTRY_IMAGE: index.docker.io/danieljesussp/app-okteto
- docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD" $REGISTRY_HOST
--tag $REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $REGISTRY_IMAGE:$CI_COMMIT_SHA
- !reference [.devops_rules, rules]
DOCKER_HUB_REGISTRY: registry.gitlab.com
--context ${CI_PROJECT_DIR}
--dockerfile ${CI_PROJECT_DIR}/Dockerfile
--destination ${DOCKER_HUB_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_SHA}
- !reference [.devops_rules, rules]
DOCKER_HUB_REGISTRY: registry.gitlab.com
FULL_IMAGE_NAME: ${DOCKER_HUB_REGISTRY}/${CI_PROJECT_PATH}:${CI_COMMIT_SHA}
- trivy image --clear-cache
- trivy image --exit-code 0 --cache-dir .trivycache/ --no-progress --security-checks vuln "$FULL_IMAGE_NAME"
- trivy image --exit-code 0 --cache-dir .trivycache/ --severity CRITICAL --no-progress --security-checks vuln "$FULL_IMAGE_NAME"
name: 'gl-container-scanning-report-${CI_BUILD_ID}-${CI_COMMIT_SHA}.json'
- !reference [.devops_rules, rules]
DOCKER_HUB_REGISTRY: registry.gitlab.com
FULL_IMAGE_NAME: ${DOCKER_HUB_REGISTRY}/${CI_PROJECT_PATH}:latest
- trivy image --clear-cache
- trivy image --security-checks license --severity UNKNOWN,HIGH,CRITICAL --license-full "$FULL_IMAGE_NAME"
name: 'gl-license-scanning-report-${CI_BUILD_ID}-${CI_COMMIT_SHA}.json'
- !reference [.devops_rules, rules]
url: https://${CI_PROJECT_TITLE}-${VA_ENV}-${OKTETO_USERNAME}.cloud.okteto.net
- !reference [.devops_rules, rules]
needs: ['deploy-staging']
url: https://${CI_PROJECT_TITLE}-${VA_ENV}-${OKTETO_USERNAME}.cloud.okteto.net
- export KUBECONFIG=${ENV_KUBECONFIG}:${KUBECONFIG:-$HOME/.kube/config}
- helm uninstall $CI_PROJECT_NAME
--namespace ${VA_ENV}-${OKTETO_USERNAME}
- !reference [.devops_rules_stop, rules]
url: https://${CI_PROJECT_TITLE}-${VA_ENV}-${OKTETO_USERNAME}.cloud.okteto.net
- !reference [.production_rules, rules]