diff --git a/.circleci/config.yml b/.circleci/config.yml index 2196a7a7..d72a6d4b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,53 +1,33 @@ --- +# 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. + version: 2.1 -orbs: - prometheus: prometheus/prometheus@0.17.1 + executors: - # Whenever the Go version is updated here, .promu.yml should - # also be updated. golang: docker: - - image: quay.io/prometheus/golang-builder:1.25-base + - image: busybox + jobs: - test: + noopjob: executor: golang + steps: - - prometheus/setup_environment - - run: make - - prometheus/store_artifact: - file: prom-label-proxy - - store_test_results: - path: test-results + - run: + command: "true" + workflows: version: 2 prom-label-proxy: jobs: - - test: + - noopjob + triggers: + - schedule: + cron: "0 0 30 2 *" filters: - tags: - only: /.*/ - - prometheus/build: - name: build - filters: - tags: - only: /.*/ - - prometheus/publish_main: - docker_hub_organization: "" # Don't publish to DockerHub. - quay_io_organization: prometheuscommunity - requires: - - test - - build - filters: - branches: - only: main - - prometheus/publish_release: - docker_hub_organization: "" # Don't publish to DockerHub. - quay_io_organization: prometheuscommunity - requires: - - test - - build - filters: - tags: - only: /^v.*/ branches: - ignore: /.*/ + only: + - main diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f1b219b4..7c3715c8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,16 @@ version: 2 updates: - - package-ecosystem: "gomod" - directory: "/" + - package-ecosystem: gomod + directory: / schedule: - interval: "weekly" + interval: monthly + open-pull-requests-limit: 10 + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + open-pull-requests-limit: 10 + # Exclude configs synced from upstream prometheus/prometheus. + exclude-paths: + - .github/workflows/container_description.yml + - .github/workflows/golangci-lint.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f3ca598a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,95 @@ +name: CI + +on: + push: + tags: + - 'v*' + branches: + - master + pull_request: + workflow_call: + +jobs: + test_go: + name: Go tests + runs-on: ubuntu-latest + container: + image: quay.io/prometheus/golang-builder:1.26-base + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: prometheus/promci-setup@5af30ba8c199a91d6c04ebdc3c48e630e355f62d # v0.1.0 + - run: make + + build: + name: Build for common architectures + runs-on: ubuntu-latest + if: | + !(github.event_name == 'push' && github.event.ref == 'refs/heads/master') + && + !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) + strategy: + matrix: + thread: [ 0, 1, 2 ] + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: prometheus/promci/build@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0 + with: + promu_opts: "-p linux/amd64 -p windows/amd64 -p darwin/amd64 -p linux/arm64 -p windows/arm64 -p darwin/arm64" + parallelism: 3 + thread: ${{ matrix.thread }} + + build_all: + name: Build for all architectures + runs-on: ubuntu-latest + if: | + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') + || + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) + strategy: + matrix: + thread: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ] + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: prometheus/promci/build@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0 + with: + parallelism: 12 + thread: ${{ matrix.thread }} + + publish_master: + name: Publish master branch artifacts + runs-on: ubuntu-latest + needs: [test_go, build_all] + if: | + (github.repository == 'prometheus-community/prom-label-proxy') + && + (github.event_name == 'push' && github.event.ref == 'refs/heads/master') + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: prometheus/promci/publish_main@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0 + with: + docker_hub_organization: prometheuscommunity + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_organization: prometheuscommunity + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} + + publish_release: + name: Publish release artifacts + runs-on: ubuntu-latest + needs: [test_go, build_all] + if: | + (github.repository == 'prometheus-community/prom-label-proxy') + && + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v0.')) + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: prometheus/promci/publish_release@769ee18070cd21cfc2a24fa912349fd3e48dee58 # v0.6.0 + with: + docker_hub_organization: prometheuscommunity + docker_hub_login: ${{ secrets.docker_hub_login }} + docker_hub_password: ${{ secrets.docker_hub_password }} + quay_io_organization: prometheuscommunity + quay_io_login: ${{ secrets.quay_io_login }} + quay_io_password: ${{ secrets.quay_io_password }} + github_token: ${{ secrets.PROMBOT_GITHUB_TOKEN }} diff --git a/.promu.yml b/.promu.yml index dfb4de9d..63df010d 100644 --- a/.promu.yml +++ b/.promu.yml @@ -1,7 +1,7 @@ --- go: # This must match .circle/config.yml. - version: 1.25 + version: 1.26 repository: path: github.com/prometheus-community/prom-label-proxy build: