sync ci
This commit is contained in:
parent
a9033d9455
commit
c5225da220
94
.gitlab-ci.yml
Normal file
94
.gitlab-ci.yml
Normal file
@ -0,0 +1,94 @@
|
||||
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
|
||||
|
||||
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: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_PIPELINE_SOURCE == "push"
|
||||
when: never
|
||||
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
||||
when: never
|
||||
|
||||
Helm Lint:
|
||||
stage: lint
|
||||
image:
|
||||
name: alpine/helm:3.11.1
|
||||
entrypoint: ["/bin/sh", "-c"]
|
||||
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 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'
|
||||
Loading…
x
Reference in New Issue
Block a user