Files
splunk-security_content/.gitlab-ci.yml
T
2022-02-17 17:16:21 +05:30

84 lines
2.8 KiB
YAML

variables:
GIT_SUBMODULE_STRATEGY: recursive
K8S_PLAYGROUND_ROLE: k8s:v1/app-play1/namespace/threat-research/role/deployer
K8S_GSTAGING_ROLE: k8s:v1/kube-wicket-iad10/namespace/tr-st-deploy/role/deployer
DOCKER_ROLE: docker:v1/registry/prefix/threat-research
K8_DEPLOYER_CONTAINER: docker.repo.splunkdev.net/threat-research/k8-deployer
SMOKETEST_RUNNER: docker.repo.splunkdev.net/threat-research/smoketest-runner
SRCBRANCH: $CI_COMMIT_REF_NAME
stages:
- publish_smoketest_runner
- publish_deployer
- smoketest_staging
- publish_build_to_pre_qa
publish_deployer:
stage: publish_deployer
image: docker.repo.splunkdev.net/ci-cd/ci-container:alpine-3.11
before_script:
- apk add --update docker
script:
- eval $(go-go vault -a ${DOCKER_ROLE})
- cd bin/ssa-end-to-end-testing/k8s-deployer
- docker build . -t ${K8_DEPLOYER_CONTAINER}:${CI_COMMIT_SHORT_SHA}
- docker push ${K8_DEPLOYER_CONTAINER}:${CI_COMMIT_SHORT_SHA}
only:
- /^ssa.*$/
- develop
publish_smoketest_runner:
stage: publish_smoketest_runner
image: docker.repo.splunkdev.net/ci-cd/ci-container:alpine-3.11
before_script:
- apk add --update docker
script:
- eval $(go-go vault -a ${DOCKER_ROLE})
- docker build bin/ssa-end-to-end-testing/smoke-test-runner -t ${SMOKETEST_RUNNER}:${CI_COMMIT_SHORT_SHA} --build-arg SRCBRANCH=$CI_COMMIT_REF_NAME
- docker push ${SMOKETEST_RUNNER}:${CI_COMMIT_SHORT_SHA}
only:
- /^ssa.*$/
- develop
smoketest_staging:
stage: smoketest_staging
resource_group: staging
dependencies:
- publish_smoketest_runner
- publish_deployer
image: ${K8_DEPLOYER_CONTAINER}:${CI_COMMIT_SHORT_SHA}
script:
- eval $(go-go vault -a ${K8S_GSTAGING_ROLE})
- eval $(go-go vault -a ${DOCKER_ROLE})
- cd /deployer/k8s
- ./deployer.sh
- ./check_deploy_status.sh
variables:
SCSENV: app_gstaging1
SMOKETEST_RUNNER_IMAGE: ${SMOKETEST_RUNNER}:${CI_COMMIT_SHORT_SHA}
only:
- /^ssa.*$/
- develop
publish_build_to_pre_qa:
stage: publish_build_to_pre_qa
artifacts:
when: always
paths:
- artifacts/*
image: python:3.8-alpine
before_script:
- apk add --update --no-cache make curl bash git
- curl -L https://github.com/screwdriver-cd/gitversion/releases/download/v1.1.1/gitversion_linux_amd64 -o /usr/local/bin/gitversion && chmod +x /usr/local/bin/gitversion
- eval $(ssh-agent -s)
script:
- mkdir -p artifacts
- pip install requests
- python security_content_automation/publish_build_to_pre_qa/publish_build_to_pre_qa.py --version $CI_COMMIT_REF_NAME --builds DA-ESS-ContentUpdate
after_script:
- cp publish_build_to_pre_qa.log artifacts/publish_build_to_pre_qa.log
rules:
- if: '$CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+\.[0-9]$/'
when: always