stages: #- unit_tests - build #- test - docker #- deploy variables: GOPROXY: https://mirrors.aliyun.com/goproxy/ SERVICE_NAME: "mop-middleware-auth" before_script: - export GOPATH=${CI_PROJECT_DIR}/.go - pwd .go-cache: variables: GOPATH: $CI_PROJECT_DIR/.go before_script: - mkdir -p .go cache: paths: - .go/pkg/mod/ #unit_tests: # stage: unit_tests # image: docker.finogeeks.club/mop-infra/golang:1.15-alpine # extends: .go-cache # script: # - go test -v .build: &build_definition stage: build image: docker.finogeeks.club/mop-infra/golang:1.15-alpine extends: .go-cache script: - go build -race -ldflags "-extldflags '-static'" #snapshot: # <<: *build_definition ## only: ## - master # artifacts: # paths: # - ${SERVICE_NAME} # expire_in: 2 days release: <<: *build_definition only: - tags artifacts: paths: - ${SERVICE_NAME} #.docker: &docker_definition # stage: docker # image: docker.finogeeks.club/mop/kaniko-executor:debug # script: # - mkdir -p /kaniko/.docker # - echo "${DOCKER_AUTH_CONFIG}" > /kaniko/.docker/config.json # - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination docker.finogeeks.club/mop/${SERVICE_NAME}:$CI_COMMIT_TAG #docker:snapshot: # <<: *docker_definition # dependencies: # - snapshot # only: # - ${CI_COMMIT_BRANCH} #docker:release: # <<: *docker_definition # dependencies: # - release # only: # - tags #deploy: # image: docker.finogeeks.club/mop-infra/alpine:latest # stage: deploy # script: # - echo ${GOPROXY}