update
This commit is contained in:
@@ -1,119 +0,0 @@
|
|||||||
stages:
|
|
||||||
- build
|
|
||||||
version:
|
|
||||||
image: gittools/gitversion:5.12.0
|
|
||||||
stage: .pre
|
|
||||||
variables:
|
|
||||||
GIT_DEPTH: "0"
|
|
||||||
script:
|
|
||||||
# Begin of version-number.sh
|
|
||||||
- |
|
|
||||||
#Check for configuration
|
|
||||||
echo "mode: ContinuousDeployment
|
|
||||||
continuous-delivery-fallback-tag: ''
|
|
||||||
branches:
|
|
||||||
master:
|
|
||||||
mode: ContinuousDeployment
|
|
||||||
tag: 'dev'
|
|
||||||
increment: Minor
|
|
||||||
track-merge-target: true
|
|
||||||
tracks-release-branches: true
|
|
||||||
is-release-branch: false
|
|
||||||
prevent-increment-of-merged-branch-version: false
|
|
||||||
release:
|
|
||||||
regex: release?[/]
|
|
||||||
mode: ContinuousDeployment
|
|
||||||
increment: Minor
|
|
||||||
tag: ''
|
|
||||||
is-release-branch: true
|
|
||||||
prevent-increment-of-merged-branch-version: true
|
|
||||||
feature:
|
|
||||||
regex: feature?[/]
|
|
||||||
mode: ContinuousDeployment
|
|
||||||
increment: Inherit
|
|
||||||
tag: 'alpha'
|
|
||||||
is-release-branch: false
|
|
||||||
prevent-increment-of-merged-branch-version: true
|
|
||||||
ignore:
|
|
||||||
sha: []
|
|
||||||
" > GitVersion.yml
|
|
||||||
version=$(/tools/dotnet-gitversion /showvariable NuGetVersionV2)
|
|
||||||
echo "VERSION=$version" >> version.env
|
|
||||||
cat version.env
|
|
||||||
# End of version-number.sh
|
|
||||||
artifacts:
|
|
||||||
reports:
|
|
||||||
dotenv: version.env
|
|
||||||
sonarcloud-check:
|
|
||||||
stage: .pre
|
|
||||||
variables:
|
|
||||||
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
|
||||||
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
|
||||||
image:
|
|
||||||
name: sonarsource/sonar-scanner-cli:latest
|
|
||||||
entrypoint: [""]
|
|
||||||
cache:
|
|
||||||
key: "${CI_JOB_NAME}"
|
|
||||||
paths:
|
|
||||||
- .sonar/cache
|
|
||||||
script:
|
|
||||||
- sonar-scanner
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_REF_NAME == 'main' || $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
||||||
build-container:
|
|
||||||
image: registry.durp.info/docker:20.10.17
|
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay2
|
|
||||||
DOCKER_TLS_CERTDIR: ""
|
|
||||||
DOCKER_HOST: tcp://127.0.0.1:2375/
|
|
||||||
services:
|
|
||||||
- name: docker:dind
|
|
||||||
entrypoint: ["dockerd-entrypoint.sh", "--tls=false"]
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
# Begin of docker-login.sh
|
|
||||||
- |
|
|
||||||
#login to docker
|
|
||||||
docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY/$CI_PROJECT_PATH
|
|
||||||
# End of docker-login.sh
|
|
||||||
|
|
||||||
# Begin of docker-build.sh
|
|
||||||
- |
|
|
||||||
#Build Docker Container
|
|
||||||
docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:$VERSION -t $CI_REGISTRY/$CI_PROJECT_PATH:latest .
|
|
||||||
docker push "$CI_REGISTRY/$CI_PROJECT_PATH:latest"
|
|
||||||
docker push "$CI_REGISTRY/$CI_PROJECT_PATH:$VERSION"
|
|
||||||
# End of docker-build.sh
|
|
||||||
needs:
|
|
||||||
- job: version
|
|
||||||
artifacts: true
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
HelmChart:
|
|
||||||
image: registry.durp.info/dtzar/helm-kubectl
|
|
||||||
stage: build
|
|
||||||
script:
|
|
||||||
# Begin of helm-addrepo.sh
|
|
||||||
- |
|
|
||||||
#Helm repo add
|
|
||||||
helm repo add --username gitlab-ci-token --password ${CI_JOB_TOKEN} ${CI_PROJECT_NAME} ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/helm/stable
|
|
||||||
# End of helm-addrepo.sh
|
|
||||||
|
|
||||||
# Begin of helm-package.sh
|
|
||||||
- |
|
|
||||||
#Helm Package
|
|
||||||
for chart in charts/*; do
|
|
||||||
if [ -d "$chart" ]; then
|
|
||||||
helm package "$chart" -d ./packages --version ${VERSION}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# End of helm-package.sh
|
|
||||||
|
|
||||||
# Begin of helm-push.sh
|
|
||||||
- "#Helm Push \n \nhelm plugin install https://github.com/chartmuseum/helm-push\nfor chart in packages/*; do\n helm cm-push ./$chart ${CI_PROJECT_NAME}\ndone\n"
|
|
||||||
# End of helm-push.sh
|
|
||||||
needs:
|
|
||||||
- job: version
|
|
||||||
artifacts: true
|
|
||||||
only:
|
|
||||||
- main
|
|
||||||
@@ -17,22 +17,28 @@ version:
|
|||||||
stage: .pre
|
stage: .pre
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
- /^release*/
|
|
||||||
|
|
||||||
sonarqube:
|
sonarqube:
|
||||||
extends: .sonarcloud-check
|
extends: .sonarcloud-check
|
||||||
stage: .pre
|
stage: .pre
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_REF_NAME == 'main' || $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||||
|
|
||||||
|
gobuild:
|
||||||
|
extends: .version
|
||||||
|
stage: build
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
extends: .docker-build-container
|
extends: .docker-build-container
|
||||||
stage: publish
|
stage: publish
|
||||||
|
needs:
|
||||||
|
- job: gobuild
|
||||||
|
artifacts: true
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
- /^release*/
|
|
||||||
|
|
||||||
helm:
|
helm:
|
||||||
extends: .helm-createchart
|
extends: .helm-createchart
|
||||||
stage: publish
|
stage: publish
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
- /^release*/
|
|
||||||
13
scripts/golang-build-api.sh
Normal file
13
scripts/golang-build-api.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#%%MULTILINE_YAML_START
|
||||||
|
#Build golang api
|
||||||
|
export GOPATH=/go
|
||||||
|
export PATH=$PATH:$GOPATH/bin
|
||||||
|
|
||||||
|
mkdir output
|
||||||
|
|
||||||
|
go install
|
||||||
|
go install github.com/swaggo/swag/cmd/swag@v1.8.12
|
||||||
|
swag init
|
||||||
|
|
||||||
|
go build -o ./output/main .
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
services:
|
services:
|
||||||
- name: docker:dind
|
- name: docker:dind
|
||||||
entrypoint: ["dockerd-entrypoint.sh", "--tls=false"]
|
entrypoint: ["dockerd-entrypoint.sh", "--tls=false"]
|
||||||
stage: build
|
|
||||||
script:
|
script:
|
||||||
- ./scripts/docker-login.sh
|
- ./scripts/docker-login.sh
|
||||||
- ./scripts/docker-build.sh
|
- ./scripts/docker-build.sh
|
||||||
|
|||||||
8
templates/golang.tpl.yml
Normal file
8
templates/golang.tpl.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.golang-build-api:
|
||||||
|
image: registry.durp.info/golang:1.20
|
||||||
|
script:
|
||||||
|
- ./scripts/golang-build-api.sh
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 hour
|
||||||
|
paths:
|
||||||
|
- $CI_PROJECT_DIR/output
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
.helm-createchart:
|
.helm-createchart:
|
||||||
image: registry.durp.info/dtzar/helm-kubectl
|
image: registry.durp.info/dtzar/helm-kubectl
|
||||||
stage: build
|
|
||||||
script:
|
script:
|
||||||
- ./scripts/helm-addrepo.sh
|
- ./scripts/helm-addrepo.sh
|
||||||
- ./scripts/helm-package.sh
|
- ./scripts/helm-package.sh
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
.sonarcloud-check:
|
.sonarcloud-check:
|
||||||
stage: .pre
|
|
||||||
variables:
|
variables:
|
||||||
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
|
||||||
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
|
||||||
@@ -12,5 +11,3 @@
|
|||||||
- .sonar/cache
|
- .sonar/cache
|
||||||
script:
|
script:
|
||||||
- sonar-scanner
|
- sonar-scanner
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_REF_NAME == 'main' || $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
.version:
|
.version:
|
||||||
image: gittools/gitversion:5.12.0
|
image: gittools/gitversion:5.12.0
|
||||||
stage: .pre
|
|
||||||
variables:
|
variables:
|
||||||
GIT_DEPTH: "0"
|
GIT_DEPTH: "0"
|
||||||
script:
|
script:
|
||||||
|
|||||||
Reference in New Issue
Block a user