github.com/thanos-io/thanos@v0.32.5/.circleci/config.yml (about) 1 # NOTE: Current plan gives 1500 build minutes per month. 2 version: 2.1 3 4 orbs: 5 go: circleci/go@1.7.2 6 git-shallow-clone: guitarrapc/git-shallow-clone@2.5.0 7 8 executors: 9 golang: 10 docker: 11 - image: cimg/go:1.21-node 12 golang-test: 13 docker: 14 - image: cimg/go:1.21-node 15 - image: quay.io/thanos/docker-swift-onlyone-authv2-keystone:v0.1 16 17 jobs: 18 test: 19 executor: golang-test 20 environment: 21 GO111MODULE: "on" 22 steps: 23 - git-shallow-clone/checkout 24 - go/mod-download-cached 25 - setup_remote_docker: 26 version: 20.10.12 27 - run: 28 name: Create Secret if PR is not forked 29 # GCS integration tests are run only for author's PR that have write access, because these tests 30 # require credentials. Env variables that sets up these tests will work only for these kind of PRs. 31 command: | 32 if ! [ -z ${GCP_PROJECT} ]; then 33 echo $GOOGLE_APPLICATION_CREDENTIALS_CONTENT > $GOOGLE_APPLICATION_CREDENTIALS 34 echo "Awesome! GCS and S3 AWS integration tests are enabled." 35 fi 36 - run: 37 name: "Run unit tests." 38 environment: 39 THANOS_TEST_OBJSTORE_SKIP: GCS,S3,AZURE,COS,ALIYUNOSS,BOS,OCI,OBS 40 # Variables for Swift testing. 41 OS_AUTH_URL: http://127.0.0.1:5000/v2.0 42 OS_PASSWORD: s3cr3t 43 OS_PROJECT_NAME: admin 44 OS_REGION_NAME: RegionOne 45 OS_USERNAME: admin 46 # taskset sets CPU affinity to 2 (current CPU limit). 47 command: | 48 if [ -z ${GCP_PROJECT} ]; then 49 export THANOS_TEST_OBJSTORE_SKIP=${THANOS_TEST_OBJSTORE_SKIP} 50 fi 51 echo "Skipping tests for object storages: ${THANOS_TEST_OBJSTORE_SKIP}" 52 taskset 2 make test 53 54 # Cross build is needed for publish_release but needs to be done outside of docker. 55 cross_build: 56 machine: true 57 working_directory: /home/circleci/.go_workspace/src/github.com/thanos-io/thanos 58 environment: 59 GOBIN: "/home/circleci/.go_workspace/go/bin" 60 PROMU_VERSION: "0.5.0" 61 steps: 62 - git-shallow-clone/checkout 63 - run: mkdir -p ${GOBIN} 64 - 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} 65 - run: mv -f ${GOBIN}/promu "${GOBIN}/promu-v${PROMU_VERSION}" 66 - run: make crossbuild -W ${GOBIN}/promu-v${PROMU_VERSION} # Ignore make dependency, it needs to be enforced somehow. 67 - persist_to_workspace: 68 root: . 69 paths: 70 - .build 71 72 publish_main: 73 executor: golang 74 steps: 75 - git-shallow-clone/checkout 76 - go/mod-download-cached 77 - setup_remote_docker: 78 version: 20.10.12 79 - attach_workspace: 80 at: . 81 # Register qemu to support multi-arch. 82 - run: docker run --privileged tonistiigi/binfmt:qemu-v6.1.0 --install all 83 - run: make crossbuild 84 - run: make docker-build 85 - run: make docker-test 86 # Upload to both dockerhub and quay.io. 87 - run: echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin 88 - run: make docker-push DOCKER_IMAGE_REPO=thanosio/thanos 89 - run: make docker-manifest DOCKER_IMAGE_REPO=thanosio/thanos 90 - run: echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" quay.io --password-stdin 91 - run: make docker-push 92 - run: make docker-manifest 93 94 publish_release: 95 executor: golang 96 steps: 97 - git-shallow-clone/checkout 98 - go/mod-download-cached 99 - setup_remote_docker: 100 version: 20.10.12 101 - attach_workspace: 102 at: . 103 - run: make tarballs-release 104 - store_artifacts: 105 path: .tarballs 106 destination: releases 107 # Register qemu to support multi-arch. 108 - run: docker run --privileged tonistiigi/binfmt:qemu-v6.1.0 --install all 109 - run: make docker-build 110 - run: make docker-test 111 # Upload to both dockerhub and quay.io. 112 - run: echo "${DOCKERHUB_PASSWORD}" | docker login -u="${DOCKERHUB_USERNAME}" --password-stdin 113 - run: make docker-push DOCKER_IMAGE_REPO=thanosio/thanos DOCKER_IMAGE_TAG=$CIRCLE_TAG 114 - run: make docker-manifest DOCKER_IMAGE_REPO=thanosio/thanos DOCKER_IMAGE_TAG=$CIRCLE_TAG 115 - run: echo "${QUAY_PASSWORD}" | docker login -u="${QUAY_USERNAME}" quay.io --password-stdin 116 - run: make docker-push DOCKER_IMAGE_TAG=$CIRCLE_TAG 117 - run: make docker-manifest DOCKER_IMAGE_TAG=$CIRCLE_TAG 118 119 workflows: 120 version: 2 121 thanos: 122 jobs: 123 - test: 124 filters: 125 tags: 126 only: /.*/ 127 - publish_main: 128 requires: 129 - test 130 filters: 131 branches: 132 only: main 133 - cross_build: 134 requires: 135 - test 136 filters: 137 tags: 138 only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ 139 branches: 140 ignore: /.*/ 141 - publish_release: 142 requires: 143 - test 144 - cross_build 145 filters: 146 tags: 147 only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ 148 branches: 149 ignore: /.*/