New Pipeline flow
This commit is contained in:
parent
4c463502aa
commit
5af34025e6
126
.gitlab-ci.yml
126
.gitlab-ci.yml
@ -1,109 +1,29 @@
|
||||
stages:
|
||||
- lint
|
||||
- build
|
||||
- deploy
|
||||
- release
|
||||
|
||||
default:
|
||||
image:
|
||||
name: "alpine/k8s:1.26.3"
|
||||
|
||||
variables:
|
||||
PIPELINE:
|
||||
description: "Defines which Path of the Pipeline"
|
||||
value: "default"
|
||||
options:
|
||||
- release
|
||||
- default
|
||||
- custom
|
||||
PROJECT_NAME_PARENT: qa
|
||||
TEST_STARTUP: ""
|
||||
TEST_BASE: ""
|
||||
TEST_PERFORMANCE: ""
|
||||
TEST_LOAD: ""
|
||||
KUBE_CONTEXT_BARATHEON: "redactmanager/infra:baratheon"
|
||||
KUBE_CONTEXT_BARATHEON2: "redactmanager/infra:baratheon2"
|
||||
KUBE_CONTEXT_LANNISTER: "redactmanager/infra:lannister"
|
||||
DEACTIVATE_TESTS: "true"
|
||||
|
||||
workflow:
|
||||
name: "Pipeline for Merge Request: $merge_request_event"
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||
variables:
|
||||
PIPELINE: "release"
|
||||
- if: $CI_COMMIT_REF_NAME =~ /release/
|
||||
variables:
|
||||
PIPELINE: "release"
|
||||
- if: $PIPELINE == "custom"
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_PIPELINE_SOURCE == "push"
|
||||
when: never
|
||||
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
||||
when: never
|
||||
include:
|
||||
- project: 'gitlab/gitlab'
|
||||
ref: 'main'
|
||||
file: 'ci-templates/helm_automatedtests_releases.yml'
|
||||
|
||||
Helm Lint:
|
||||
Construct Readme:
|
||||
stage: lint
|
||||
allow_failure: true
|
||||
needs:
|
||||
- Get Scripts
|
||||
rules:
|
||||
- changes:
|
||||
- values.yaml
|
||||
image:
|
||||
name: alpine/helm:3.11.1
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
name: registry.knecon.com/knecon/devops/readme-generator:1.1.0
|
||||
script:
|
||||
- helm lint .
|
||||
|
||||
Helm Template:
|
||||
stage: lint
|
||||
image:
|
||||
name: alpine/helm:3.11.1
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
script:
|
||||
- echo "Templating for Answerfile Container Upload"
|
||||
- helm template . -f testanswers/answers-startup.yml
|
||||
|
||||
Kubescore:
|
||||
stage: lint
|
||||
image: zegl/kube-score:latest
|
||||
script:
|
||||
- echo "Scoring the Chart YAML"
|
||||
- kube-score score Chart.yaml
|
||||
|
||||
Nexus custom Upload:
|
||||
stage: release
|
||||
needs:
|
||||
- Helm Template
|
||||
- Helm Lint
|
||||
rules:
|
||||
- if: $PIPELINE == "custom"
|
||||
image: registry.knecon.com/knecon/devops/build-image:latest
|
||||
script:
|
||||
- VERSION=$(cat Chart.yaml | grep "^version:" | sed 's/^version:\s\(.*\)$/\1/g')
|
||||
- uploadFile=$( helm package . | awk 'NF>1{print q $NF}' )
|
||||
- curl -s -u "${CI_NEXUS_USER}:${CI_NEXUS_PASSWORD}" "${CI_NEXUS_ADDRESS}:443/repository/red-dev/" --upload-file $uploadFile
|
||||
|
||||
Nexus Upload:
|
||||
stage: release
|
||||
needs:
|
||||
- Helm Template
|
||||
- Helm Lint
|
||||
rules:
|
||||
- if: $PIPELINE == "release"
|
||||
image: registry.knecon.com/knecon/devops/build-image:latest
|
||||
script:
|
||||
- VERSION=$(cat Chart.yaml | grep "^version:" | sed 's/^version:\s\(.*\)$/\1/g')
|
||||
- uploadFile=$( helm package . | awk 'NF>1{print q $NF}' )
|
||||
- curl -s -u "${CI_NEXUS_USER}:${CI_NEXUS_PASSWORD}" "${CI_NEXUS_ADDRESS}:443/repository/red-dev/" --upload-file $uploadFile
|
||||
- echo "FILE=$(echo $uploadFile)" >> variables.env
|
||||
- echo "VERSION=$(echo $VERSION)" >> variables.env
|
||||
artifacts:
|
||||
reports:
|
||||
dotenv: variables.env
|
||||
|
||||
Helm-pre-release:
|
||||
stage: release
|
||||
rules:
|
||||
- if: $PIPELINE == "release"
|
||||
needs:
|
||||
- job: Nexus Upload
|
||||
artifacts: true
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
script:
|
||||
- echo "Releasing version $VERSION"
|
||||
release:
|
||||
tag_name: '$VERSION'
|
||||
description: '$VERSION'
|
||||
ref: '$CI_COMMIT_SHA'
|
||||
assets:
|
||||
links:
|
||||
- name: '$FILE'
|
||||
url: '${CI_NEXUS_ADDRESS}/repository/red-dev/$FILE'
|
||||
- ls -la
|
||||
- source gitlab/ci-templates/qa/script_library.sh; check_readme_values
|
||||
|
||||
4
answers/container-upload.yaml
Normal file
4
answers/container-upload.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
global:
|
||||
imageRegistry: "nexus.knecon.com:5001"
|
||||
imagePullSecrets:
|
||||
- knecon
|
||||
Loading…
x
Reference in New Issue
Block a user