Skip to content
Snippets Groups Projects
Commit dd4d9a97 authored by M9713's avatar M9713
Browse files

Delete .gitlab-ci.yml

parent 1791264f
No related branches found
No related tags found
No related merge requests found
Pipeline #439161 failed
stages:
- build
- test
- deploy-dev
- deploy-prod
variables:
# Save manifest repository URL to a variable for clarity
MANIFEST_REPOSITORY: git@gitlab.labranet.jamk.fi:conduit-gitops/gitops.git
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
# build from dockerfile with Kaniko
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile ./Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
only:
- master
tags:
#assign shared runner
- general
test:
stage: test
script: echo "insert tests here... "
tags:
# assign shared runner
- general
deploy-dev:
stage: deploy-dev
image: alpine:latest
before_script:
# kustomize install
- apk add --no-cache git curl bash
- curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
- mv kustomize /usr/local/bin/
- git config --global user.email "gitlabbu@gitloponer.com"
- git config --global user.name "GitLab CI"
# add SSH key to runner from CI/CD variables so that it can push to repository
- apk add --no-cache --update openssh-client
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 400 ~/.ssh/known_hosts
- chmod 400 ~/.ssh/id_rsa
script:
# clone manifest repository - update image tag with kustomize - push changes to same repository
- git clone --single-branch --branch dev $MANIFEST_REPOSITORY
- ls -l
- cd gitops/dev/backend/
- kustomize edit set image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- cat kustomization.yaml
- git commit -am '[skip ci] DEV image updated'
- git push origin dev
only:
- master
tags:
# assign shared runner
- general
deploy-prod:
stage: deploy-prod
image: alpine:latest
before_script:
# kustomize install
- apk add --no-cache git curl bash
- curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
- mv kustomize /usr/local/bin/
- git config --global user.email "gitlabbu@gitloponer.com"
- git config --global user.name "GitLab CI"
# add SSH key to runner from CI/CD variables so that it can push to repository
- apk add --no-cache --update openssh-client
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 400 ~/.ssh/known_hosts
- chmod 400 ~/.ssh/id_rsa
script:
# clone manifest repository - update image tag with kustomize - push changes to same repository
- git clone --single-branch --branch master $MANIFEST_REPOSITORY
- ls -l
- cd gitops/prod/backend/
- kustomize edit set image $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- cat kustomization.yaml
- git commit -am '[skip ci] PROD image updated'
- git push origin master
only:
- master
tags:
# assign shared runner
- general
# requires manual approval to deploy to production
when: manual
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment