Loading .gitlab-ci.yml +56 −2 Original line number Diff line number Diff line stages: - lint # - test # - analyze - test - analyze - dev_image_build #- dev_deploy #- dev_workflows Loading Loading @@ -53,6 +53,60 @@ lint: - tags - develop tests_job: stage: test tags: - hypo image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/golang:latest before_script: - mkdir -p ${SONAR_GO_COVERAGE} - echo "machine ${CI_SERVER_HOST} login gitlab-ci-token password ${CI_JOB_TOKEN}" > ~/.netrc - chmod 600 ~/.netrc - export GOPRIVATE="${CI_SERVER_HOST}/rep/*" - export GONOSUMDB="${CI_SERVER_HOST}/rep/*" - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/rep/".insteadOf "https://${CI_SERVER_HOST}/rep/" script: - curl -fsSL https://get.docker.com -o get-docker.sh - chmod +x ./get-docker.sh - ./get-docker.sh - echo "127.0.0.1 $(hostname)" >> /etc/hosts - echo "$GROUP_ACCESS_TOKEN" | docker login $HYPO_APPS_REGISTRY -u $GROUP_ACCESS_NAME --password-stdin - go mod download - gofmt -e -s -w . - go vet ./... - go test -v -cover -coverprofile=${SONAR_GO_COVERAGE}/coverage.out -coverpkg=./... ./... after_script: - docker container prune -f || true artifacts: paths: - ${SONAR_GO_COVERAGE} except: - main - tags - develop sonar-analysis: stage: analyze tags: - hypo image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/sonarsource/sonar-scanner-cli:latest script: - sonar-scanner -Dsonar.projectKey=${CI_PROJECT_TITLE} -Dsonar.coverage.exclusions=**/*_test.go -Dsonar.go.coverage.reportPaths=${SONAR_GO_COVERAGE}/coverage.out -Dsonar.go.govet.reportPaths=${SONAR_GO_COVERAGE}/vet_report.json -Dsonar.go.golangci-lint.reportPaths=${SONAR_GO_COVERAGE}/golanci-report.xml allow_failure: true needs: - job: tests_job artifacts: true artifacts: when: always paths: - ${SONAR_GO_COVERAGE} expire_in: 1 day dependencies: - tests_job except: - main - tags - develop dev_image_build_job: stage: dev_image_build Loading Loading
.gitlab-ci.yml +56 −2 Original line number Diff line number Diff line stages: - lint # - test # - analyze - test - analyze - dev_image_build #- dev_deploy #- dev_workflows Loading Loading @@ -53,6 +53,60 @@ lint: - tags - develop tests_job: stage: test tags: - hypo image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/golang:latest before_script: - mkdir -p ${SONAR_GO_COVERAGE} - echo "machine ${CI_SERVER_HOST} login gitlab-ci-token password ${CI_JOB_TOKEN}" > ~/.netrc - chmod 600 ~/.netrc - export GOPRIVATE="${CI_SERVER_HOST}/rep/*" - export GONOSUMDB="${CI_SERVER_HOST}/rep/*" - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/rep/".insteadOf "https://${CI_SERVER_HOST}/rep/" script: - curl -fsSL https://get.docker.com -o get-docker.sh - chmod +x ./get-docker.sh - ./get-docker.sh - echo "127.0.0.1 $(hostname)" >> /etc/hosts - echo "$GROUP_ACCESS_TOKEN" | docker login $HYPO_APPS_REGISTRY -u $GROUP_ACCESS_NAME --password-stdin - go mod download - gofmt -e -s -w . - go vet ./... - go test -v -cover -coverprofile=${SONAR_GO_COVERAGE}/coverage.out -coverpkg=./... ./... after_script: - docker container prune -f || true artifacts: paths: - ${SONAR_GO_COVERAGE} except: - main - tags - develop sonar-analysis: stage: analyze tags: - hypo image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/sonarsource/sonar-scanner-cli:latest script: - sonar-scanner -Dsonar.projectKey=${CI_PROJECT_TITLE} -Dsonar.coverage.exclusions=**/*_test.go -Dsonar.go.coverage.reportPaths=${SONAR_GO_COVERAGE}/coverage.out -Dsonar.go.govet.reportPaths=${SONAR_GO_COVERAGE}/vet_report.json -Dsonar.go.golangci-lint.reportPaths=${SONAR_GO_COVERAGE}/golanci-report.xml allow_failure: true needs: - job: tests_job artifacts: true artifacts: when: always paths: - ${SONAR_GO_COVERAGE} expire_in: 1 day dependencies: - tests_job except: - main - tags - develop dev_image_build_job: stage: dev_image_build Loading