37 lines
1.3 KiB
YAML
37 lines
1.3 KiB
YAML
stages:
|
|
- config
|
|
- build
|
|
- run
|
|
|
|
config hello:
|
|
stage: config
|
|
image: repository.umisen.com/external/kubectl:latest
|
|
tags:
|
|
- rancher-dev
|
|
script:
|
|
- kubectl -n gitlab-runner create configmap hello-config --from-file=etc/config.json
|
|
|
|
build hello:
|
|
stage: build
|
|
image: repository.umisen.com/external/kaniko:latest
|
|
tags:
|
|
- rancher-dev
|
|
script:
|
|
- export CI_REGISTRY="repository.umisen.com"
|
|
- export CI_REGISTRY_IMAGE="${CI_REGISTRY}/build/tools/hello:latest"
|
|
- export CI_DOCKERFILE="$CI_PROJECT_DIR/Dockerfile"
|
|
- export CI_REGISTRY_AUTH_API="${CI_REGISTRY}/v1"
|
|
- export CI_REGISTRY_USERNAME="gitlab-runner"
|
|
- export CI_REGISTRY_PASSWORD="sonar@404"
|
|
- echo '10.220.10.17 repository.umisen.com' >> /etc/hosts
|
|
- mkdir -p /kaniko/.docker
|
|
- echo "{\"auths\":{\"${CI_REGISTRY_AUTH_API}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USERNAME}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
|
|
- /kaniko/executor --skip-tls-verify-registry "${CI_REGISTRY}" --context "${CI_PROJECT_DIR}" --dockerfile "${CI_DOCKERFILE}" --destination "${CI_REGISTRY_IMAGE}" #--insecure --insecure-registry
|
|
|
|
run hello:
|
|
stage: run
|
|
image: repository.umisen.com/external/kubectl:latest
|
|
tags:
|
|
- rancher-dev
|
|
script:
|
|
- kubectl apply -f hello.yaml |