github.com/influxdata/telegraf@v1.30.3/.circleci/config.yml (about) 1 version: 2.1 2 orbs: 3 win: circleci/windows@5.0.0 4 aws-cli: circleci/aws-cli@3.1.1 5 6 executors: 7 telegraf-ci: 8 working_directory: '/go/src/github.com/influxdata/telegraf' 9 resource_class: large 10 docker: 11 - image: 'quay.io/influxdb/telegraf-ci:1.22.3' 12 environment: 13 GOFLAGS: -p=4 14 mac: 15 working_directory: '~/go/src/github.com/influxdata/telegraf' 16 resource_class: macos.m1.medium.gen1 17 macos: 18 xcode: 14.2.0 19 environment: 20 HOMEBREW_NO_AUTO_UPDATE: 1 21 GOFLAGS: -p=4 22 23 commands: 24 check-changed-files-or-halt: 25 steps: 26 - run: ./scripts/check-file-changes.sh 27 test-go: 28 parameters: 29 os: 30 type: string 31 default: "linux" 32 arch: 33 type: string 34 default: "amd64" 35 gotestsum: 36 type: string 37 default: "gotestsum" 38 steps: 39 - run: ./scripts/install_gotestsum.sh << parameters.os >> << parameters.gotestsum >> 40 - unless: 41 condition: 42 equal: [ "386", << parameters.arch >> ] 43 steps: 44 - run: echo 'export RACE="-race"' >> $BASH_ENV 45 - when: 46 condition: 47 equal: [ windows, << parameters.os >> ] 48 steps: 49 - run: echo 'export CGO_ENABLED=1' >> $BASH_ENV 50 - run: | 51 GOARCH=<< parameters.arch >> ./<< parameters.gotestsum >> -- ${RACE} -short ./... 52 package-build: 53 parameters: 54 type: 55 type: string 56 default: "" 57 nightly: 58 type: boolean 59 default: false 60 steps: 61 - checkout 62 - check-changed-files-or-halt 63 - attach_workspace: 64 at: '/go' 65 - when: 66 condition: 67 equal: [ windows, << parameters.type >> ] 68 steps: 69 - run: go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.4.0 70 - when: 71 condition: << parameters.nightly >> 72 steps: 73 - run: 74 command: 'NIGHTLY=1 make package include_packages="$(make << parameters.type >>)"' 75 no_output_timeout: 30m 76 - unless: 77 condition: 78 or: 79 - << parameters.nightly >> 80 steps: 81 - run: 82 command: 'make package include_packages="$(make << parameters.type >>)"' 83 no_output_timeout: 30m 84 - store_artifacts: 85 path: './build/dist' 86 destination: 'build/dist' 87 - persist_to_workspace: 88 root: './build' 89 paths: 90 - 'dist' 91 jobs: 92 lint-linux: 93 executor: telegraf-ci 94 steps: 95 - checkout 96 - run: ./scripts/make_docs.sh 97 - check-changed-files-or-halt 98 - run: 'make deps' 99 - run: 'make tidy' 100 - run: 'make check' 101 - run: 'make check-deps' 102 - run: 103 name: "Install golangci-lint" 104 command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.0 105 - run: 106 name: "golangci-lint/Linux" 107 command: GOGC=80 GOMEMLIMIT=6656MiB /go/bin/golangci-lint run --verbose 108 lint-macos: 109 executor: telegraf-ci 110 steps: 111 - checkout 112 - check-changed-files-or-halt 113 - run: 114 name: "Install golangci-lint" 115 command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.0 116 - run: 117 name: "golangci-lint/macOS" 118 command: GOGC=80 GOMEMLIMIT=6656MiB GOOS=darwin /go/bin/golangci-lint run --verbose --timeout=30m 119 no_output_timeout: 30m 120 lint-windows: 121 executor: telegraf-ci 122 steps: 123 - checkout 124 - check-changed-files-or-halt 125 - run: 126 name: "Install golangci-lint" 127 command: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.58.0 128 - run: 129 name: "golangci-lint/Windows" 130 command: GOGC=80 GOMEMLIMIT=6656MiB GOOS=windows /go/bin/golangci-lint run --verbose --timeout=30m 131 no_output_timeout: 30m 132 test-go-linux: 133 executor: telegraf-ci 134 steps: 135 - checkout 136 - check-changed-files-or-halt 137 - test-go 138 test-go-linux-386: 139 executor: telegraf-ci 140 steps: 141 - checkout 142 - check-changed-files-or-halt 143 - run: 'GOARCH=386 make deps' 144 - run: 'GOARCH=386 make tidy' 145 - run: 'GOARCH=386 make check' 146 - test-go: 147 arch: "386" 148 test-integration: 149 machine: 150 image: ubuntu-2204:current 151 resource_class: large 152 steps: 153 - checkout 154 - check-changed-files-or-halt 155 - run: 'sh ./scripts/installgo_linux.sh' 156 - run: 'make deps' 157 - run: 'make test-integration' 158 test-go-mac: 159 executor: mac 160 steps: 161 - checkout 162 - check-changed-files-or-halt 163 - run: 'sh ./scripts/installgo_mac.sh' 164 - test-go: 165 os: darwin 166 arch: arm64 167 test-go-windows: 168 executor: 169 name: win/default 170 shell: bash.exe 171 size: large 172 steps: 173 - checkout 174 - check-changed-files-or-halt 175 - run: git config --system core.longpaths true 176 - run: choco feature enable -n allowGlobalConfirmation 177 - run: 'sh ./scripts/installgo_windows.sh' 178 - run: choco install mingw 179 - run: echo 'export PATH="$PATH:/c/ProgramData/mingw64/mingw64/bin"' >> $BASH_ENV 180 - test-go: 181 os: windows 182 gotestsum: "gotestsum.exe" 183 test-licenses: 184 executor: telegraf-ci 185 steps: 186 - checkout 187 - check-changed-files-or-halt 188 - run: 'make build_tools' 189 - run: './tools/license_checker/license_checker -whitelist ./tools/license_checker/data/whitelist' 190 windows-package: 191 parameters: 192 nightly: 193 type: boolean 194 default: false 195 executor: telegraf-ci 196 steps: 197 - package-build: 198 type: windows 199 nightly: << parameters.nightly >> 200 darwin-amd64-package: 201 parameters: 202 nightly: 203 type: boolean 204 default: false 205 executor: telegraf-ci 206 steps: 207 - package-build: 208 type: darwin-amd64 209 nightly: << parameters.nightly >> 210 darwin-arm64-package: 211 parameters: 212 nightly: 213 type: boolean 214 default: false 215 executor: telegraf-ci 216 steps: 217 - package-build: 218 type: darwin-arm64 219 nightly: << parameters.nightly >> 220 i386-package: 221 parameters: 222 nightly: 223 type: boolean 224 default: false 225 executor: telegraf-ci 226 steps: 227 - package-build: 228 type: i386 229 nightly: << parameters.nightly >> 230 ppc64le-package: 231 parameters: 232 nightly: 233 type: boolean 234 default: false 235 executor: telegraf-ci 236 steps: 237 - package-build: 238 type: ppc64le 239 nightly: << parameters.nightly >> 240 riscv64-package: 241 parameters: 242 nightly: 243 type: boolean 244 default: false 245 executor: telegraf-ci 246 steps: 247 - package-build: 248 type: riscv64 249 nightly: << parameters.nightly >> 250 loong64-package: 251 parameters: 252 nightly: 253 type: boolean 254 default: false 255 executor: telegraf-ci 256 steps: 257 - package-build: 258 type: loong64 259 nightly: << parameters.nightly >> 260 s390x-package: 261 parameters: 262 nightly: 263 type: boolean 264 default: false 265 executor: telegraf-ci 266 steps: 267 - package-build: 268 type: s390x 269 nightly: << parameters.nightly >> 270 armel-package: 271 parameters: 272 nightly: 273 type: boolean 274 default: false 275 executor: telegraf-ci 276 steps: 277 - package-build: 278 type: armel 279 nightly: << parameters.nightly >> 280 amd64-package: 281 parameters: 282 nightly: 283 type: boolean 284 default: false 285 executor: telegraf-ci 286 steps: 287 - package-build: 288 type: amd64 289 nightly: << parameters.nightly >> 290 arm64-package: 291 parameters: 292 nightly: 293 type: boolean 294 default: false 295 executor: telegraf-ci 296 steps: 297 - package-build: 298 type: arm64 299 nightly: << parameters.nightly >> 300 mipsel-package: 301 parameters: 302 nightly: 303 type: boolean 304 default: false 305 executor: telegraf-ci 306 steps: 307 - package-build: 308 type: mipsel 309 nightly: << parameters.nightly >> 310 mips-package: 311 parameters: 312 nightly: 313 type: boolean 314 default: false 315 executor: telegraf-ci 316 steps: 317 - package-build: 318 type: mips 319 nightly: << parameters.nightly >> 320 armhf-package: 321 parameters: 322 nightly: 323 type: boolean 324 default: false 325 executor: telegraf-ci 326 steps: 327 - package-build: 328 type: armhf 329 nightly: << parameters.nightly >> 330 nightly: 331 executor: telegraf-ci 332 steps: 333 - attach_workspace: 334 at: '/build' 335 - run: 336 command: | 337 aws s3 sync /build/dist s3://dl.influxdata.com/telegraf/nightlies/ \ 338 --exclude "*" \ 339 --include "*.tar.gz" \ 340 --include "*.deb" \ 341 --include "*.rpm" \ 342 --include "*.zip" \ 343 --acl public-read 344 release: 345 executor: telegraf-ci 346 steps: 347 - attach_workspace: 348 at: '/build' 349 - run: 350 command: | 351 aws s3 sync /build/dist s3://dl.influxdata.com/telegraf/releases/ \ 352 --exclude "*" \ 353 --include "telegraf*.DIGESTS" \ 354 --include "telegraf*.digests" \ 355 --include "telegraf*.asc" \ 356 --include "telegraf*.deb" \ 357 --include "telegraf*.dmg" \ 358 --include "telegraf*.rpm" \ 359 --include "telegraf*.tar.gz" \ 360 --include "telegraf*.zip" \ 361 --acl public-read 362 docker-nightly: 363 machine: 364 image: ubuntu-2204:current 365 steps: 366 - run: 367 name: login to quay.io 368 command: docker login --username="${QUAY_USER}" --password="${QUAY_PASS}" quay.io 369 - run: 370 name: clone influxdata/influxdata-docker 371 command: git clone https://github.com/influxdata/influxdata-docker 372 - run: 373 name: build and push telegraf:nightly 374 command: | 375 cd influxdata-docker/telegraf/nightly 376 docker build -t telegraf . 377 docker tag telegraf quay.io/influxdb/telegraf-nightly:latest 378 docker image ls 379 docker push quay.io/influxdb/telegraf-nightly:latest 380 - run: 381 name: build and push telegraf:nightly-alpine 382 command: | 383 cd influxdata-docker/telegraf/nightly/alpine 384 docker build -t telegraf-alpine . 385 docker tag telegraf-alpine quay.io/influxdb/telegraf-nightly:alpine 386 docker image ls 387 docker push quay.io/influxdb/telegraf-nightly:alpine 388 amd64-package-test-nightly: 389 machine: 390 image: ubuntu-2204:current 391 steps: 392 - checkout 393 - attach_workspace: 394 at: '.' 395 - run: sh ./scripts/installgo_linux.sh 396 - run: ./scripts/install_incus.sh 397 - run: cd tools/package_incus_test && go build 398 - run: sudo ./tools/package_incus_test/package_incus_test --package $(find ./dist -name "*_amd64.deb") 399 - run: sudo ./tools/package_incus_test/package_incus_test --package $(find ./dist -name "*.x86_64.rpm") 400 package-sign-windows: 401 machine: 402 image: ubuntu-2204:current 403 resource_class: medium 404 steps: 405 - checkout 406 - check-changed-files-or-halt 407 - attach_workspace: 408 at: '.' 409 - run: 410 name: "Sign Windows Executables" 411 command: ./scripts/sign-windows.sh 412 - persist_to_workspace: 413 root: '.' 414 paths: 415 - 'dist' 416 package-sign-mac: 417 executor: mac 418 working_directory: /Users/distiller/project 419 environment: 420 FL_OUTPUT_DIR: output 421 FASTLANE_LANE: test 422 shell: /bin/bash --login -o pipefail 423 steps: 424 - checkout 425 - check-changed-files-or-halt 426 - attach_workspace: 427 at: '.' 428 - run: 429 command: | 430 sh ./scripts/mac-signing.sh 431 - persist_to_workspace: 432 root: './build' 433 paths: 434 - 'dist' 435 package-consolidate: 436 docker: 437 - image: alpine 438 steps: 439 - attach_workspace: 440 at: '.' 441 - run: 442 command: | 443 cd dist && find . -type f -name '._*' -delete 444 - store_artifacts: 445 path: './dist' 446 destination: 'build/dist' 447 - run: 448 command: | 449 echo "This job contains all the final artifacts." 450 share-artifacts: 451 executor: aws-cli/default 452 steps: 453 - checkout 454 - check-changed-files-or-halt 455 - run: 456 command: | 457 PR=${CIRCLE_PULL_REQUEST##*/} 458 printf -v payload '{ "pullRequestNumber": "%s" }' "$PR" 459 curl -X POST "https://182c7jdgog.execute-api.us-east-1.amazonaws.com/prod/shareArtifacts" --data "$payload" 460 package-sign: 461 circleci_ip_ranges: true 462 docker: 463 - image: quay.io/influxdb/rsign:latest 464 auth: 465 username: $QUAY_RSIGN_USERNAME 466 password: $QUAY_RSIGN_PASSWORD 467 steps: 468 - add_ssh_keys: 469 fingerprints: 470 - 3b:c0:fe:a0:8a:93:33:69:de:22:ac:20:a6:ed:6b:e5 471 - attach_workspace: 472 at: . 473 - run: | 474 cd dist 475 476 # Generate the *.DIGESTS files. This must be done before the signing 477 # step so that the *.DIGEST files are also signed. 478 for target in * 479 do 480 sha256sum "${target}" > "${target}.DIGESTS" 481 done 482 483 for target in * 484 do 485 case "${target}" 486 in 487 # rsign is shipped on Alpine Linux which uses "busybox ash" instead 488 # of bash. ash is somewhat more posix compliant and is missing some 489 # extensions and niceties from bash. 490 *.deb|*.dmg|*.rpm|*.tar.gz|*.zip|*.DIGESTS) 491 rsign "${target}" 492 ;; 493 esac 494 done 495 496 for target in * 497 do 498 case "${target}" 499 in 500 *.deb|*.dmg|*.rpm|*.tar.gz|*.zip) 501 # Print sha256 hash and target for artifacts all in one file 502 # for use later during the release. 503 cat "${target}.DIGESTS" >> "telegraf-${CIRCLE_TAG}.DIGESTS" 504 ;; 505 esac 506 done 507 - persist_to_workspace: 508 root: ./ 509 paths: 510 - dist 511 - store_artifacts: 512 path: ./dist 513 514 workflows: 515 version: 2 516 check: 517 when: 518 not: 519 equal: [ scheduled_pipeline, << pipeline.trigger_source >> ] 520 jobs: 521 - 'lint-linux': 522 filters: 523 tags: 524 only: /.*/ 525 - 'lint-macos': 526 filters: 527 tags: 528 only: /.*/ 529 - 'lint-windows': 530 filters: 531 tags: 532 only: /.*/ 533 - 'test-go-linux': 534 filters: 535 tags: 536 only: /.*/ 537 - 'test-go-linux-386': 538 filters: 539 tags: 540 only: /.*/ 541 - 'test-go-mac': 542 filters: 543 tags: # only runs on tags if you specify this filter 544 only: /.*/ 545 - 'test-go-windows': 546 filters: 547 tags: 548 only: /.*/ 549 - 'test-integration': 550 filters: 551 tags: 552 only: /.*/ 553 - 'windows-package': 554 requires: 555 - 'test-go-windows' 556 filters: 557 tags: 558 only: /.*/ 559 - 'darwin-amd64-package': 560 requires: 561 - 'test-go-mac' 562 filters: 563 tags: 564 only: /.*/ 565 - 'darwin-arm64-package': 566 requires: 567 - 'test-go-mac' 568 filters: 569 branches: 570 ignore: 571 - master 572 tags: 573 only: /.*/ 574 - 'i386-package': 575 requires: 576 - 'test-go-linux-386' 577 filters: 578 branches: 579 ignore: 580 - master 581 tags: 582 only: /.*/ 583 - 'ppc64le-package': 584 requires: 585 - 'test-go-linux' 586 filters: 587 branches: 588 ignore: 589 - master 590 tags: 591 only: /.*/ 592 - 'riscv64-package': 593 requires: 594 - 'test-go-linux' 595 filters: 596 branches: 597 ignore: 598 - master 599 tags: 600 only: /.*/ 601 - 'loong64-package': 602 requires: 603 - 'test-go-linux' 604 filters: 605 branches: 606 ignore: 607 - /.*/ 608 tags: 609 only: /.*/ 610 - 's390x-package': 611 requires: 612 - 'test-go-linux' 613 filters: 614 branches: 615 ignore: 616 - master 617 tags: 618 only: /.*/ 619 - 'armel-package': 620 requires: 621 - 'test-go-linux' 622 filters: 623 branches: 624 ignore: 625 - master 626 tags: 627 only: /.*/ 628 - 'amd64-package': 629 requires: 630 - 'test-go-linux' 631 filters: 632 tags: 633 only: /.*/ 634 - 'arm64-package': 635 requires: 636 - 'test-go-linux' 637 filters: 638 branches: 639 ignore: 640 - master 641 tags: 642 only: /.*/ 643 - 'armhf-package': 644 requires: 645 - 'test-go-linux' 646 filters: 647 branches: 648 ignore: 649 - master 650 tags: 651 only: /.*/ 652 - 'mipsel-package': 653 requires: 654 - 'test-go-linux' 655 filters: 656 branches: 657 ignore: 658 - master 659 tags: 660 only: /.*/ 661 - 'mips-package': 662 requires: 663 - 'test-go-linux' 664 filters: 665 branches: 666 ignore: 667 - master 668 tags: 669 only: /.*/ 670 - 'share-artifacts': 671 requires: 672 - 'i386-package' 673 - 'ppc64le-package' 674 - 'riscv64-package' 675 - 's390x-package' 676 - 'armel-package' 677 - 'amd64-package' 678 - 'mipsel-package' 679 - 'mips-package' 680 - 'loong64-package' 681 - 'darwin-amd64-package' 682 - 'darwin-arm64-package' 683 - 'windows-package' 684 - 'arm64-package' 685 - 'armhf-package' 686 filters: 687 branches: 688 ignore: 689 - master 690 - release.* 691 tags: 692 ignore: /.*/ 693 - 'package-sign-windows': 694 requires: 695 - 'windows-package' 696 filters: 697 tags: 698 only: /.*/ 699 branches: 700 ignore: /.*/ 701 - 'package-sign-mac': 702 requires: 703 - 'darwin-amd64-package' 704 - 'darwin-arm64-package' 705 filters: 706 tags: 707 only: /.*/ 708 branches: 709 ignore: /.*/ 710 - 'package-sign': 711 requires: 712 - 'i386-package' 713 - 'ppc64le-package' 714 - 'riscv64-package' 715 - 's390x-package' 716 - 'armel-package' 717 - 'amd64-package' 718 - 'mipsel-package' 719 - 'mips-package' 720 - 'loong64-package' 721 - 'arm64-package' 722 - 'armhf-package' 723 - 'package-sign-mac' 724 - 'package-sign-windows' 725 filters: 726 tags: 727 only: /.*/ 728 branches: 729 ignore: /.*/ 730 - 'package-consolidate': 731 requires: 732 - 'i386-package' 733 - 'ppc64le-package' 734 - 's390x-package' 735 - 'armel-package' 736 - 'amd64-package' 737 - 'mipsel-package' 738 - 'mips-package' 739 - 'arm64-package' 740 - 'armhf-package' 741 - 'riscv64-package' 742 - 'loong64-package' 743 - 'package-sign-mac' 744 - 'package-sign-windows' 745 - 'package-sign' 746 filters: 747 tags: 748 only: /.*/ 749 branches: 750 ignore: /.*/ 751 - 'release': 752 requires: 753 - 'package-consolidate' 754 filters: 755 tags: 756 only: /.*/ 757 branches: 758 ignore: /.*/ 759 nightly: 760 when: 761 equal: [ scheduled_pipeline, << pipeline.trigger_source >> ] 762 jobs: 763 - 'lint-linux' 764 - 'lint-macos' 765 - 'lint-windows' 766 - 'test-go-linux' 767 - 'test-go-linux-386' 768 - 'test-go-mac' 769 - 'test-go-windows' 770 - 'test-licenses' 771 - 'windows-package': 772 name: 'windows-package-nightly' 773 nightly: true 774 requires: 775 - 'test-go-windows' 776 - 'darwin-amd64-package': 777 name: 'darwin-amd64-package-nightly' 778 nightly: true 779 requires: 780 - 'test-go-mac' 781 - 'darwin-arm64-package': 782 name: 'darwin-arm64-package-nightly' 783 nightly: true 784 requires: 785 - 'test-go-mac' 786 - 'i386-package': 787 name: 'i386-package-nightly' 788 nightly: true 789 requires: 790 - 'test-go-linux-386' 791 - 'ppc64le-package': 792 name: 'ppc64le-package-nightly' 793 nightly: true 794 requires: 795 - 'test-go-linux' 796 - 'riscv64-package': 797 name: 'riscv64-package-nightly' 798 nightly: true 799 requires: 800 - 'test-go-linux' 801 - 'loong64-package': 802 name: 'loong64-package-nightly' 803 nightly: true 804 requires: 805 - 'test-go-linux' 806 - 's390x-package': 807 name: 's390x-package-nightly' 808 nightly: true 809 requires: 810 - 'test-go-linux' 811 - 'armel-package': 812 name: 'armel-package-nightly' 813 nightly: true 814 requires: 815 - 'test-go-linux' 816 - 'amd64-package': 817 name: 'amd64-package-nightly' 818 nightly: true 819 requires: 820 - 'test-go-linux' 821 - 'arm64-package': 822 name: 'arm64-package-nightly' 823 nightly: true 824 requires: 825 - 'test-go-linux' 826 - 'armhf-package': 827 name: 'armhf-package-nightly' 828 nightly: true 829 requires: 830 - 'test-go-linux' 831 - 'mipsel-package': 832 name: 'mipsel-package-nightly' 833 nightly: true 834 requires: 835 - 'test-go-linux' 836 - 'mips-package': 837 name: 'mips-package-nightly' 838 nightly: true 839 requires: 840 - 'test-go-linux' 841 - 'package-sign-windows': 842 requires: 843 - 'windows-package-nightly' 844 - 'package-sign-mac': 845 requires: 846 - 'darwin-amd64-package-nightly' 847 - 'darwin-arm64-package-nightly' 848 - nightly: 849 requires: 850 - 'amd64-package-test-nightly' 851 - 'arm64-package-nightly' 852 - 'armel-package-nightly' 853 - 'armhf-package-nightly' 854 - 'darwin-amd64-package-nightly' 855 - 'darwin-arm64-package-nightly' 856 - 'i386-package-nightly' 857 - 'mips-package-nightly' 858 - 'mipsel-package-nightly' 859 - 'loong64-package-nightly' 860 - 'ppc64le-package-nightly' 861 - 'riscv64-package-nightly' 862 - 's390x-package-nightly' 863 - 'windows-package-nightly' 864 - docker-nightly: 865 requires: 866 - 'nightly' 867 - amd64-package-test-nightly: 868 requires: 869 - 'amd64-package-nightly'