# This file is a template, and might need editing before it works on your project. image: ${CI_REGISTRY}/b20/nodebuild:latest # cache: # key: "node_modules" # paths: # - node_modules variables: # Please edit to your GitLab project REPO_NAME: BaaS-UI # The problem is that to be able to use go get, one needs to put # the repository in the $GOPATH. So for example if your gitlab domain # is gitlab.com, and that your repository is namespace/project, and # the default GOPATH being /go, then you'd need to have your # repository in /go/src/gitlab.com/namespace/project # Thus, making a symbolic link corrects this. before_script: ## docker builder host # 这里使用docker host模式,此时要求host可以连上CI_REGISTRY镜像仓库 - export DOCKER_HOST=${CI_DOCKER_BUILD_HOST} stages: - build - deploy build: stage: build variables: DOCKER_DRIVER: overlay2 only: - develop # cache: # key: "node_modules" # paths: # - node_modules script: - npm i --registry=http://nexus.hyperchain.cn/repository/npm-taobao-proxy/ - npm run docs:build - docker build -t baasui:latest . - docker tag baasui:latest ${CI_REGISTRY}/b20/baasui:latest - docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY} - docker push ${CI_REGISTRY}/b20/baasui:latest deploy: stage: deploy image: cnych/kubectl only: - develop script: - mkdir -p /root/.kube - echo ${CI_KUBE_CONFIG_BASE64} | base64 -d > /root/.kube/config - export KUBECONFIG=/root/.kube/config - | if kubectl apply -f deployment.yaml | grep -q unchanged; then echo "=> Patching deployment to force image update." kubectl patch -f deployment.yaml -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"ci-last-updated\":\"$(date +'%s')\"}}}}}" else echo "=> Deployment apply has changed the object, no need to force image update." fi - kubectl apply -f service.yaml || true - kubectl apply -f ingress.yaml - kubectl rollout status -f deployment.yaml # - kubectl apply -f baasui.yaml -n ci