diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..3e271536c348e39bce3dd55b175659eee463aaa8 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,46 @@ +variables: + CONTAINER_IMAGE: 'harbor.sch.bme.hu/kszk-coderweek/web' + +stages: + - build +# - deploy + +build: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + + script: + - echo "{\"auths\":{\"harbor.sch.bme.hu\":{\"username\":\"$REGISTRY_USER\",\"password\":\"$REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor + --context "${CI_PROJECT_DIR}" + --dockerfile "${CI_PROJECT_DIR}/dockerfile" + --destination "${CONTAINER_IMAGE}:$CI_COMMIT_REF_NAME" + --destination "${CONTAINER_IMAGE}:latest" + only: + - tags + + +deploy: + stage: deploy + image: + name: alpine + entrypoint: [ "" ] + before_script: + - DIR="$PWD" + - apk add bash curl gettext + - cd /tmp + - curl https://get.helm.sh/helm-v3.13.2-linux-amd64.tar.gz | tar xvz + - cd /tmp/linux-amd64 + - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + - chmod +x kubectl + - export PATH="$PATH:/tmp/linux-amd64" + - cd "$DIR" + script: + - kubectl config set-context --current --namespace coderweek + - cd k8s + - envsubst < Chart.yaml.template > Chart.yaml + - envsubst < values.yaml | helm upgrade --install coderweek . -n coderweek --values - + only: + - tags