hamburger/.gitlab-ci.yml

46 lines
1011 B
YAML
Raw Normal View History

2023-09-08 20:36:31 +02:00
stages:
- build
- deploy
.kube-context:
before_script:
- if [ -n "$KUBE_CONTEXT" ]; then kubectl config use-context "$KUBE_CONTEXT"; fi
2023-09-08 20:58:51 +02:00
build:
2023-09-08 20:36:31 +02:00
stage: build
2023-09-08 20:58:51 +02:00
image:
name: gcr.io/kaniko-project/executor:v1.14.0-debug
entrypoint: [""]
2023-09-08 20:36:31 +02:00
script:
2023-09-08 21:20:41 +02:00
- |
cat << EOF > /kaniko/.docker/config.json
{
"auths": {
2023-09-08 21:22:55 +02:00
"https://registry.yaemiku.dev": {
2023-09-08 21:20:41 +02:00
"auth": "${DOCKER_PASSWORD}"
}
}
}
EOF
2023-09-08 20:58:51 +02:00
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "registry.yaemiku.dev/yaemiku/hamburger:${CI_COMMIT_TAG}"
rules:
- if: $CI_COMMIT_TAG
2023-09-08 20:36:31 +02:00
deploy:
stage: deploy
extends: [.kube-context]
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
image:
name: bitnami/kubectl:latest
entrypoint: [""]
script:
2023-09-08 21:07:47 +02:00
- ls
- kubectl apply -f $CI_PROJECT_DIR/hamburger.yaml
- kubectl get pods
rules:
- if: $CI_COMMIT_TAG