This commit is contained in:
2023-04-09 19:39:37 +00:00
parent 3b6644120c
commit 1229f9d86a
5 changed files with 37 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Build Docker Container
docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:latest .
docker push "$CI_REGISTRY/$CI_PROJECT_PATH:latest"
docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:$GITVERSION -t $CI_REGISTRY/$CI_PROJECT_PATH:latest .
docker push "$CI_REGISTRY/$CI_PROJECT_PATH:latest"
docker push "$CI_REGISTRY/$CI_PROJECT_PATH:$GITVERSION"

5
scripts/helm-addrepo.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#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

9
scripts/helm-package.sh Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Helm Package
for chart in charts/*; do
if [ -d "$chart" ]; then
helm package "$chart" -d ./packages --version ${GITVERSION}
fi
done

8
scripts/helm-push.sh Normal file
View File

@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#%%MULTILINE_YAML_START
#Helm Push
helm plugin install https://github.com/chartmuseum/helm-push
for chart in packages/*; do
helm cm-push ./$chart ${CI_PROJECT_NAME}
done

View File

@@ -1,5 +1,6 @@
stages:
- build
build-container:
image: docker:20.10.16
variables:
@@ -11,4 +12,14 @@ build-container:
- ./scripts/docker-login.sh
- ./scripts/docker-build.sh
only:
- main
- main
HelmChart:
image: dtzar/helm-kubectl
stage: build
script:
- ./scripts/helm-addrepo.sh
- ./scripts/helm-package.sh
- ./scripts/helm-push.sh
only:
- main