Update 4 files

- /scripts/version-number.sh
- /scripts/helm-package.sh
- /scripts/docker-build.sh
- /templates/build-container.tpl.yml
This commit is contained in:
2023-04-09 20:08:02 +00:00
parent 084365f985
commit 0060b532f6
4 changed files with 27 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Build Docker Container
docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:$GITVERSION -t $CI_REGISTRY/$CI_PROJECT_PATH:latest .
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:$GITVERSION"
docker push "$CI_REGISTRY/$CI_PROJECT_PATH:$VERSION"

View File

@@ -4,6 +4,6 @@
for chart in charts/*; do
if [ -d "$chart" ]; then
helm package "$chart" -d ./packages --version ${GITVERSION}
helm package "$chart" -d ./packages --version ${VERSION}
fi
done

View File

@@ -0,0 +1,9 @@
if [ -z "$VERSION" ]; then
VERSION="1"
fi
export COMMIT_COUNT=$(git rev-list --count HEAD)
export BUILD_NUMBER=$CI_PIPELINE_ID
export VERSION="$VERSION.$COMMIT_COUNT.$BUILD_NUMBER"
echo $VERSION > version.env
cat version.env

View File

@@ -1,6 +1,15 @@
stages:
- versioning
- build
version:
stage: versioning
script:
- ./scripts/version-number.sh
artifacts:
reports:
dotenv: version.env
build-container:
image: docker:20.10.16
variables:
@@ -11,6 +20,9 @@ build-container:
script:
- ./scripts/docker-login.sh
- ./scripts/docker-build.sh
needs:
- job: version
artifacts: true
only:
- main
@@ -21,5 +33,8 @@ HelmChart:
- ./scripts/helm-addrepo.sh
- ./scripts/helm-package.sh
- ./scripts/helm-push.sh
needs:
- job: version
artifacts: true
only:
- main