forked from kubermatic/terraform-provider-kubermatic
-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
55 lines (50 loc) · 2.04 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
image: golang:latest
variables:
# Please edit to your GitLab project
REPO_NAME: github.com/syseleven/terraform-provider-metakube
# The problem is that to be able to use go get, one needs to put
# the repository in the $GOPATH. For example if your domain
# is gitlab.com, and that your repository is namespace/project, and
# the default GOPATH is /go, then you'd need to have your
# repository in /go/src/gitlab.com/namespace/project
# Making symbolic link corrects this.
before_script:
- mkdir -p $GOPATH/src/$(dirname $REPO_NAME)
- ln -svf $CI_PROJECT_DIR $GOPATH/src/$REPO_NAME
- cd $GOPATH/src/$REPO_NAME
stages:
- pre-test
- test
env:
stage: pre-test
image: ubuntu
script:
- apt-get update
- apt-get install jq curl -y
- touch test.env
- echo export METAKUBE_K8S_VERSION_OS=$(./scripts/get_versions.sh openstack|jq '.[] | select(.default == true) | .version') >> test.env
- echo export METAKUBE_K8S_VERSION_AWS=$(./scripts/get_versions.sh aws| jq 'map(select(.default == null)) | last | .version') >> test.env
- echo export METAKUBE_K8S_OLDER_VERSION=$(./scripts/get_versions.sh openstack| jq 'map(select(.default == null)) | last | .version') >> test.env
- echo export METAKUBE_OPENSTACK_IMAGE="22.04" >> test.env
- echo export METAKUBE_OPENSTACK_IMAGE2="20.04" >> test.env
- echo export METAKUBE_OPENSTACK_FLAVOR=m1.small >> test.env
artifacts:
paths:
- test.env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /k8s-.*/i || $CI_PIPELINE_SOURCE == "web"
test:
stage: test
timeout: 3h
script:
- source test.env
- ./scripts/goimportscheck.sh
- go vet $(go list ./... | grep -v /vendor/)
- go test -race $(go list ./... | grep -v /vendor/)
- go build -race -ldflags "-extldflags '-static'" -o $CI_PROJECT_DIR/mybinary
- go test ./metakube -v -sweep=all
- TF_ACC=1 go test ./metakube -v -timeout 3h -parallel 10 -run TestAcc
needs:
- env
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /k8s-.*/i || $CI_PIPELINE_SOURCE == "web"