/
config.yml
141 lines (134 loc) · 4.64 KB
/
config.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# NOTE: Current plan gives 1500 build minutes per month.
version: 2.1
orbs:
go: circleci/go@1.5.0
executors:
golang:
docker:
- image: cimg/go:1.16-node
golang-test:
docker:
- image: cimg/go:1.16-node
- image: quay.io/thanos/docker-swift-onlyone-authv2-keystone:v0.1
jobs:
test:
executor: golang-test
environment:
GO111MODULE: 'on'
steps:
- checkout
- go/mod-download-cached
- setup_remote_docker:
version: 17.07.0-ce
- run:
name: Create Secret if PR is not forked
# GCS integration tests are run only for author's PR that have write access, because these tests
# require credentials. Env variables that sets up these tests will work only for these kind of PRs.
command: |
if ! [ -z ${GCP_PROJECT} ]; then
echo $GOOGLE_APPLICATION_CREDENTIALS_CONTENT > $GOOGLE_APPLICATION_CREDENTIALS
echo "Awesome! GCS and S3 AWS integration tests are enabled."
fi
- run:
name: "Run unit tests."
environment:
THANOS_TEST_OBJSTORE_SKIP: AZURE,COS,ALIYUNOSS,BOS
# Variables for Swift testing.
OS_AUTH_URL: http://127.0.0.1:5000/v2.0
OS_PASSWORD: s3cr3t
OS_PROJECT_NAME: admin
OS_REGION_NAME: RegionOne
OS_USERNAME: admin
# taskset sets CPU affinity to 2 (current CPU limit).
command: |
if [ -z ${GCP_PROJECT} ]; then
export THANOS_TEST_OBJSTORE_SKIP=${THANOS_TEST_OBJSTORE_SKIP},GCS,S3
fi
echo "Skipping tests for object storages: ${THANOS_TEST_OBJSTORE_SKIP}"
taskset 2 make test
# Cross build is needed for publish_release but needs to be done outside of docker.
cross_build:
machine: true
working_directory: /home/circleci/.go_workspace/src/github.com/thanos-io/thanos
environment:
GOBIN: "/home/circleci/.go_workspace/go/bin"
PROMU_VERSION: "0.5.0"
steps:
- checkout
- run: mkdir -p ${GOBIN}
- run: curl -L "https://github.com/prometheus/promu/releases/download/v${PROMU_VERSION}/promu-${PROMU_VERSION}.$(go env GOOS)-$(go env GOARCH).tar.gz" | tar --strip-components=1 -xzf - -C ${GOBIN}
- run: mv -f ${GOBIN}/promu "${GOBIN}/promu-v${PROMU_VERSION}"
- run: make crossbuild -W ${GOBIN}/promu-v${PROMU_VERSION} # Ignore make dependency, it needs to be enforced somehow.
- persist_to_workspace:
root: .
paths:
- .build
publish_main:
executor: golang
steps:
- checkout
- go/mod-download-cached
- setup_remote_docker:
version: 17.07.0-ce
- attach_workspace:
at: .
- run: ln -s .build/linux-amd64/thanos thanos
- run: make docker
- run: docker run thanos --help
# Upload to both dockerhub and quay.io.
- run: echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin
- run: make docker-push DOCKER_IMAGE_REPO=thanosio/thanos
- run: echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" quay.io --password-stdin
- run: make docker-push
publish_release:
executor: golang
steps:
- checkout
- go/mod-download-cached
- setup_remote_docker:
version: 17.07.0-ce
- attach_workspace:
at: .
- run: make tarballs-release
- store_artifacts:
path: .tarballs
destination: releases
- run: ln -s .build/linux-amd64/thanos thanos
- run: make docker
- run: docker run thanos --help
# Upload to both dockerhub and quay.io.
- run: echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin
- run: make docker-push DOCKER_IMAGE_REPO=thanosio/thanos DOCKER_IMAGE_TAG=$CIRCLE_TAG
- run: echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" quay.io --password-stdin
- run: make docker-push DOCKER_IMAGE_TAG=$CIRCLE_TAG
workflows:
version: 2
thanos:
jobs:
- test:
filters:
tags:
only: /.*/
- publish_main:
requires:
- test
filters:
branches:
only: main
- cross_build:
requires:
- test
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /.*/
- publish_release:
requires:
- test
- cross_build
filters:
tags:
only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/
branches:
ignore: /.*/