diff --git a/deployment/example.gitlab-ci.yml b/deployment/example.gitlab-ci.yml new file mode 100644 index 0000000..0a281d3 --- /dev/null +++ b/deployment/example.gitlab-ci.yml @@ -0,0 +1,37 @@ +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 \ No newline at end of file