-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
73 lines (73 loc) · 2.85 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/ee/user/application_security/secret_detection/#customizing-settings
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
default:
tags:
- kubernetes-farpoint-default
image: golang:latest
stages:
- test
- build
- deploy
- release
format:
stage: test
script:
- go fmt $(go list ./... | grep -v /vendor/)
- go vet $(go list ./... | grep -v /vendor/)
- go test -race $(go list ./... | grep -v /vendor/)
compile:
stage: build
variables:
KUBERNETES_CPU_REQUEST: 4
KUBERNETES_CPU_LIMIT: 6
KUBERNETES_MEMORY_REQUEST: 12Gi
KUBERNETES_MEMORY_LIMIT: 16Gi
script:
- go install github.com/mitchellh/gox@latest
- mkdir -p bin
- $GOPATH/bin/gox --parallel=4 --osarch=!darwin/386 --output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"
- $GOPATH/bin/gox --parallel=4 --osarch=darwin/arm64 --output="bin/{{.Dir}}_{{.OS}}_{{.Arch}}"
artifacts:
paths:
- bin
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: "$CI_COMMIT_TAG"
script:
- echo "Creating new release"
release:
tag_name: "$CI_COMMIT_TAG"
description: "$CI_COMMIT_TAG"
ref: "$CI_COMMIT_SHA"
assets:
links:
- name: Linux-x86
url: $CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_SHA/raw/bin/${CI_PROJECT_NAME}_linux_386?job=compile
link_type: package
- name: Linux-x64
url: $CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_SHA/raw/bin/${CI_PROJECT_NAME}_linux_amd64?job=compile
link_type: package
- name: Windows-x86
url: $CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_SHA/raw/bin/${CI_PROJECT_NAME}_windows_386.exe?job=compile
link_type: package
- name: Windows-x64
url: $CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_SHA/raw/bin/${CI_PROJECT_NAME}_windows_amd64.exe?job=compile
link_type: package
- name: Darwin-amd64
url: $CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_SHA/raw/bin/${CI_PROJECT_NAME}_darwin_amd64?job=compile
link_type: package
- name: Darwin-arm64
url: $CI_PROJECT_URL/-/jobs/artifacts/$CI_COMMIT_SHA/raw/bin/${CI_PROJECT_NAME}_darwin_arm64?job=compile
link_type: package
include:
- template: Security/Secret-Detection.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
sast:
stage: test