forked from prometheus/prometheus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to github actions (prometheus#11235)
Signed-off-by: Julien Pivotto <[email protected]> Signed-off-by: Julien Pivotto <[email protected]>
- Loading branch information
1 parent
4bcf833
commit 8f3bcfa
Showing
11 changed files
with
434 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,197 +1,33 @@ | ||
--- | ||
version: 2.1 | ||
# Prometheus has switched to GitHub action. | ||
# Circle CI is not disabled repository-wise so that previous pull requests | ||
# continue working. | ||
# This file does not generate any CircleCI workflow. | ||
|
||
orbs: | ||
prometheus: prometheus/[email protected] | ||
go: circleci/[email protected] | ||
win: circleci/[email protected] | ||
version: 2.1 | ||
|
||
executors: | ||
# Whenever the Go version is updated here, .promu.yml | ||
# should also be updated. | ||
golang: | ||
docker: | ||
- image: quay.io/prometheus/golang-builder:1.18-base | ||
golang_oldest: | ||
docker: | ||
- image: quay.io/prometheus/golang-builder:1.17-base | ||
- image: busybox | ||
|
||
jobs: | ||
test_go: | ||
noopjob: | ||
executor: golang | ||
|
||
steps: | ||
- prometheus/setup_environment | ||
- go/load-cache: | ||
key: v1 | ||
- run: | ||
command: make GO_ONLY=1 | ||
environment: | ||
# Run garbage collection more aggressively to avoid getting OOMed during the lint phase. | ||
GOGC: "20" | ||
# By default Go uses GOMAXPROCS but a Circle CI executor has many | ||
# cores (> 30) while the CPU and RAM resources are throttled. If we | ||
# don't limit this to the number of allocated cores, the job is | ||
# likely to get OOMed and killed. | ||
GOOPTS: "-p 2" | ||
GOMAXPROCS: "2" | ||
GO111MODULE: "on" | ||
- run: go test ./tsdb/ -test.tsdb-isolation=false | ||
- run: make -C documentation/examples/remote_storage | ||
- run: make -C documentation/examples | ||
- prometheus/check_proto: | ||
version: "3.15.8" | ||
- prometheus/store_artifact: | ||
file: prometheus | ||
- prometheus/store_artifact: | ||
file: promtool | ||
- go/save-cache: | ||
key: v1 | ||
- store_test_results: | ||
path: test-results | ||
|
||
test_ui: | ||
executor: golang | ||
|
||
steps: | ||
- checkout | ||
- restore_cache: | ||
keys: | ||
- v3-npm-deps-{{ checksum "web/ui/package-lock.json" }} | ||
- v3-npm-deps- | ||
- run: make assets-tarball | ||
- run: make ui-lint | ||
- run: make ui-test | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- .tarballs | ||
- save_cache: | ||
key: v3-npm-deps-{{ checksum "web/ui/package-lock.json" }} | ||
paths: | ||
- ~/.npm | ||
|
||
test_windows: | ||
executor: | ||
name: win/default | ||
shell: powershell | ||
working_directory: /go/src/github.com/prometheus/prometheus | ||
steps: | ||
- checkout | ||
- run: | ||
# Temporary workaround until circleci updates go. | ||
command: | | ||
choco upgrade -y golang | ||
- run: | ||
command: refreshenv | ||
- run: | ||
command: | | ||
$TestTargets = go list ./... | Where-Object { $_ -NotMatch "(github.com/prometheus/prometheus/discovery.*|github.com/prometheus/prometheus/config|github.com/prometheus/prometheus/web)"} | ||
go test $TestTargets -vet=off -v | ||
environment: | ||
GOGC: "20" | ||
GOOPTS: "-p 2" | ||
|
||
test_golang_oldest: | ||
executor: golang_oldest | ||
steps: | ||
- checkout | ||
- run: make build | ||
- run: go test ./tsdb/... | ||
- run: go test ./tsdb/ -test.tsdb-isolation=false | ||
|
||
test_mixins: | ||
executor: golang | ||
steps: | ||
- checkout | ||
- run: go install ./cmd/promtool/. | ||
- run: go install github.com/google/go-jsonnet/cmd/jsonnet@latest | ||
- run: go install github.com/google/go-jsonnet/cmd/jsonnetfmt@latest | ||
- run: go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest | ||
- run: make -C documentation/prometheus-mixin clean | ||
- run: make -C documentation/prometheus-mixin jb_install | ||
- run: make -C documentation/prometheus-mixin | ||
- run: git diff --exit-code | ||
|
||
repo_sync: | ||
executor: golang | ||
steps: | ||
- checkout | ||
- run: ./scripts/sync_repo_files.sh | ||
command: "true" | ||
|
||
workflows: | ||
version: 2 | ||
prometheus: | ||
jobs: | ||
- test_go: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- test_ui: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- test_golang_oldest: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- test_mixins: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- test_windows: | ||
filters: | ||
branches: | ||
only: /^(release-.*|.*build-all.*)$/ | ||
tags: | ||
only: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ | ||
- prometheus/build: | ||
name: build | ||
parallelism: 3 | ||
promu_opts: "-p linux/amd64 -p windows/amd64 -p linux/arm64 -p darwin/amd64 -p darwin/arm64 -p linux/386" | ||
filters: | ||
tags: | ||
ignore: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ | ||
branches: | ||
ignore: /^(main|release-.*|.*build-all.*)$/ | ||
- prometheus/build: | ||
name: build_all | ||
parallelism: 12 | ||
filters: | ||
branches: | ||
only: /^(main|release-.*|.*build-all.*)$/ | ||
tags: | ||
only: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ | ||
- prometheus/publish_main: | ||
context: org-context | ||
requires: | ||
- test_go | ||
- test_ui | ||
- build_all | ||
filters: | ||
branches: | ||
only: main | ||
image: circleci/golang:1-node | ||
- prometheus/publish_release: | ||
context: org-context | ||
requires: | ||
- test_go | ||
- test_ui | ||
- build_all | ||
filters: | ||
tags: | ||
only: /^v2(\.[0-9]+){2}(-.+|[^-.]*)$/ | ||
branches: | ||
ignore: /.*/ | ||
image: circleci/golang:1-node | ||
daily: | ||
- noopjob | ||
triggers: | ||
- schedule: | ||
cron: "49 19 * * *" | ||
cron: "0 0 30 2 *" | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
jobs: | ||
- repo_sync: | ||
context: org-context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Build | ||
inputs: | ||
thread: | ||
type: integer | ||
description: Current thread | ||
required: true | ||
default: 3 | ||
parallelism: | ||
type: integer | ||
description: Number of builds to do in parallel | ||
default: 3 | ||
promu_opts: | ||
type: string | ||
description: Options to pass to promu | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: ./.github/actions/setup_environment | ||
- run: ~/go/bin/promu crossbuild -v --parallelism ${{ inputs.parallelism }} --parallelism-thread ${{ inputs.thread }} ${{ inputs.promu_opts }} | ||
shell: bash | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: | | ||
.build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Check proto files | ||
inputs: | ||
version: | ||
type: string | ||
description: Protoc version | ||
default: "3.5.1" | ||
runs: | ||
using: composite | ||
steps: | ||
- run: | | ||
env | ||
set -x | ||
curl -s -L https://github.com/protocolbuffers/protobuf/releases/download/v${{ inputs.version }}/protoc-${{ inputs.version }}-linux-x86_64.zip > /tmp/protoc.zip | ||
unzip -d /tmp /tmp/protoc.zip | ||
chmod +x /tmp/bin/protoc | ||
export PATH=/tmp/bin:$PATH | ||
make proto | ||
shell: bash | ||
- run: git diff --exit-code | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish image | ||
inputs: | ||
registry: | ||
type: string | ||
description: Docker registry | ||
organization: | ||
type: string | ||
description: Organization | ||
login: | ||
type: string | ||
description: Username | ||
password: | ||
type: string | ||
description: Password | ||
dockerfile_path: | ||
description: Path to Dockerfile | ||
type: string | ||
default: "" | ||
dockerbuild_context: | ||
description: Path to Dockerbuild context | ||
type: string | ||
default: "" | ||
container_image_name: | ||
description: Name of the container image | ||
type: string | ||
default: "" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Download all workflow run artifacts | ||
uses: actions/download-artifact@v3 | ||
- uses: ./.github/actions/setup_environment | ||
- if: inputs.dockerfile_path != "" | ||
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile | ||
- if: inputs.container_image_name != "" | ||
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile | ||
- if: inputs.dockerbuild_context != "" | ||
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile | ||
- run: | | ||
touch /tmp/tmp-profile | ||
. /tmp/tmp-profile | ||
make docker DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }} | ||
docker images | ||
echo ${{ inputs.password }} | docker login -u ${{ inputs.login }} --password-stdin ${{ inputs.registry }} | ||
make docker-publish DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }} | ||
make docker-manifest DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Publish image | ||
inputs: | ||
docker_hub_organization: | ||
type: string | ||
description: DockerHub organization | ||
default: prom | ||
docker_hub_login: | ||
type: string | ||
description: DockerHub username | ||
docker_hub_password: | ||
type: string | ||
description: DockerHub password | ||
quay_io_organization: | ||
type: string | ||
description: Quay.io organization | ||
default: prometheus | ||
quay_io_login: | ||
type: string | ||
description: Quay.io username | ||
quay_io_password: | ||
type: string | ||
description: Quay.io password | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: ./.github/actions/setup_environment | ||
- uses: ./.github/actions/publish_images | ||
if: inputs.docker_hub_organization != '' && inputs.docker_hub_login != '' | ||
with: | ||
registry: docker.io | ||
organization: ${{ inputs.docker_hub_organization }} | ||
login: ${{ inputs.docker_hub_login }} | ||
password: ${{ inputs.docker_hub_password }} | ||
- uses: ./.github/actions/publish_images | ||
if: inputs.quay_io_organization != '' && inputs.quay_io_login != '' | ||
with: | ||
registry: quay.io | ||
organization: ${{ inputs.quay_io_organization }} | ||
login: ${{ inputs.quay_io_login }} | ||
password: ${{ inputs.quay_io_password }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Publish image | ||
inputs: | ||
docker_hub_organization: | ||
type: string | ||
description: DockerHub organization | ||
default: prom | ||
docker_hub_login: | ||
type: string | ||
description: DockerHub username | ||
docker_hub_password: | ||
type: string | ||
description: DockerHub password | ||
quay_io_organization: | ||
type: string | ||
description: Quay.io organization | ||
default: prometheus | ||
quay_io_login: | ||
type: string | ||
description: Quay.io username | ||
quay_io_password: | ||
type: string | ||
description: Quay.io password | ||
runs: | ||
using: composite | ||
steps: | ||
- uses: ./.github/actions/setup_environment | ||
- run: promu crossbuild tarballs | ||
shell: bash | ||
- run: promu checksum .tarballs | ||
shell: bash | ||
- run: promu release .tarballs | ||
shell: bash | ||
- uses: ./.github/actions/publish_release_images | ||
if: inputs.docker_hub_organization != '' && inputs.docker_hub_login != '' | ||
with: | ||
registry: docker.io | ||
organization: ${{ inputs.docker_hub_organization }} | ||
login: ${{ inputs.docker_hub_login }} | ||
password: ${{ inputs.docker_hub_password }} | ||
- uses: ./.github/actions/publish_release_images | ||
if: inputs.quay_io_organization != '' && inputs.quay_io_login != '' | ||
with: | ||
registry: quay.io | ||
organization: ${{ inputs.quay_io_organization }} | ||
login: ${{ inputs.quay_io_login }} | ||
password: ${{ inputs.quay_io_password }} |
Oops, something went wrong.