.travis.yml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ---
  2. dist: focal
  3. language: c
  4. addons:
  5. apt:
  6. packages: ['moreutils']
  7. env:
  8. global:
  9. - RELEASE_CHANNEL=nightly
  10. before_install:
  11. - exec > >(ts -s '%H:%M:%.S ') 2>&1
  12. - source .travis/utils.sh
  13. # Install dependencies for all, once
  14. #
  15. install:
  16. - sudo apt-get install -y libuv1-dev liblz4-dev libjudy-dev libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev gnupg python3-pip
  17. - sudo pip3 install git-semver==0.3.2 # 11/Sep/2019: git-semver tip was broken, so we had to force last good run of it
  18. - source tests/installer/slack.sh
  19. - export NOTIF_CHANNEL="automation-beta"
  20. - if [ "${TRAVIS_REPO_SLUG}" = "netdata/netdata" ]; then export NOTIF_CHANNEL="automation"; fi;
  21. - export BUILD_VERSION="$(cat packaging/version | cut -d'-' -f1)"
  22. - export LATEST_RELEASE_VERSION="$(cat packaging/version | cut -d'-' -f1)"
  23. - export LATEST_RELEASE_DATE="$(git log -1 --format=%aD "${LATEST_RELEASE_VERSION}" | cat)"
  24. - if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"[Build latest]"* ]]; then export BUILD_VERSION="$(cat packaging/version | cut -d'-' -f1,2 | sed -e 's/-/./g').latest"; fi;
  25. - export DEPLOY_REPO="netdata" # Default production packaging repository
  26. - export PACKAGING_USER="netdata" # Standard package cloud account
  27. - if [[ "${TRAVIS_COMMIT_MESSAGE}" = *"[Build latest]"* ]]; then export DEPLOY_REPO="netdata-edge"; fi;
  28. - export PACKAGE_CLOUD_RETENTION_DAYS=30
  29. - if [ ! "${TRAVIS_REPO_SLUG}" = "netdata/netdata" ]; then export DEPLOY_REPO="netdata-devel"; fi;
  30. # These are release-related artifacts and have to be evaluated before we start doing conditional checks inside stages
  31. - source ".travis/tagger.sh"
  32. - export GIT_TAG="$(git tag --points-at)"
  33. - git submodule update --init --recursive
  34. # Setup notification system
  35. #
  36. notifications:
  37. webhooks:
  38. urls:
  39. - https://app.fossa.io/hooks/travisci
  40. # Define the stage sequence and conditionals
  41. #
  42. stages:
  43. # Mandatory runs, we always want these executed
  44. - name: Build process
  45. if: commit_message =~ /^((?!\[Package (amd64|arm64|i386) (DEB|RPM)( .*)?\]).)*$/
  46. # Nightly operations
  47. - name: Nightly operations
  48. if: branch = master AND type = cron AND env(RUN_NIGHTLY) = yes
  49. - name: Nightly release
  50. if: branch = master AND type = cron AND env(RUN_NIGHTLY) = yes
  51. # Scheduled releases
  52. - name: Support activities on main branch
  53. if: branch = master AND type != pull_request AND type != cron AND repo = netdata/netdata
  54. # We don't run on release candidates
  55. - name: Publish for release
  56. if: >-
  57. branch = master
  58. AND type != pull_request
  59. AND type != cron
  60. AND tag !~ /(-rc)/
  61. AND commit_message =~ /\[netdata (release candidate|(major|minor|patch) release)\]/
  62. # Define stage implementation details
  63. #
  64. jobs:
  65. # This is a hook to help us introduce "soft" errors on our process
  66. allow_failures:
  67. - env: ALLOW_SOFT_FAILURE_HERE=true
  68. include:
  69. # Ensure netdata code builds successfully
  70. - stage: Build process
  71. name: Standard netdata build
  72. script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it --enable-plugin-nfacct --enable-plugin-freeipmi --disable-lto
  73. env: CFLAGS='-O1 -Wall -Wextra -Wformat-signedness -fstack-protector-all -fno-common -DNETDATA_INTERNAL_CHECKS=1 -D_FORTIFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1'
  74. after_failure: post_message "TRAVIS_MESSAGE" "<!here> standard netdata build is failing (Still dont know which one, will improve soon)"
  75. - stage: Support activities on main branch
  76. name: Generate changelog for release (only on special and tagged commit msg)
  77. before_script: post_message "TRAVIS_MESSAGE" "Support activities on main branch initiated" "${NOTIF_CHANNEL}"
  78. script:
  79. - echo "GIT Branch:" && git branch
  80. - echo "Last commit:" && git log -1
  81. - echo "GIT Describe:" && git describe
  82. - echo "packaging/version:" && cat packaging/version
  83. - if [[ -z "${GIT_TAG}" ]]; then echo "Running set tag for release" && set_tag_for_release; fi;
  84. - .travis/generate_changelog_and_tag_release.sh
  85. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Changelog generation and tag of release, failed"
  86. git:
  87. depth: false
  88. if: commit_message =~ /\[netdata (release candidate|(major|minor|patch) release)\]/ AND tag !~ /(-rc)/ OR (env(GIT_TAG) IS present AND NOT env(GIT_TAG) IS blank)
  89. # We only publish if a TAG has been set during packaging
  90. - stage: Publish for release
  91. name: Trigger release build and draft release creation
  92. script:
  93. - git checkout "${TRAVIS_BRANCH}" && export BUILD_VERSION="$(cat packaging/version)"
  94. - .travis/trigger_artifact_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}" "release"
  95. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger release artifact build during nightly release" "${NOTIF_CHANNEL}"
  96. - name: Trigger Docker image build and publish
  97. script:
  98. - git checkout "${TRAVIS_BRANCH}" && export BUILD_VERSION="$(cat packaging/version | cut -d'-' -f1)"
  99. - .travis/trigger_docker_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}"
  100. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger docker build during release" "${NOTIF_CHANNEL}"
  101. - name: Trigger DEB and RPM package build
  102. script:
  103. - git checkout "${TRAVIS_BRANCH}" && export BUILD_VERSION="$(cat packaging/version | sed 's/^v//' | cut -d'-' -f1)"
  104. - .travis/trigger_package_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}" "release"
  105. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger deb and rpm package build during release" "${NOTIF_CHANNEL}"
  106. # This is the nightly pre-execution step (Jobs, preparatory steps for nightly, etc)
  107. - stage: Nightly operations
  108. # This is generating the changelog for nightly release and publish it
  109. name: Generate nightly changelog
  110. script:
  111. - ".travis/nightlies.sh"
  112. - ".travis/check_changelog_last_modification.sh"
  113. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Nightly changelog generation failed"
  114. git:
  115. depth: false
  116. # This is the nightly execution step
  117. #
  118. - stage: Nightly release
  119. name: Trigger nightly artifact build and upload
  120. script:
  121. - git checkout "${TRAVIS_BRANCH}" && export BUILD_VERSION="$(cat packaging/version)"
  122. - .travis/trigger_artifact_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}" "nightly"
  123. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger release artifact build during nightly release" "${NOTIF_CHANNEL}"
  124. - name: Trigger Docker image build and publish
  125. script: .travis/trigger_docker_build.sh "${GITHUB_TOKEN}" "nightly"
  126. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger docker build during nightly release" "${NOTIF_CHANNEL}"
  127. - name: Trigger DEB and RPM package build
  128. script:
  129. - git checkout "${TRAVIS_BRANCH}" && export BUILD_VERSION="$(cat packaging/version | sed 's/^v//')"
  130. - .travis/trigger_package_build.sh "${GITHUB_TOKEN}" "${BUILD_VERSION}" "nightly"
  131. after_failure: post_message "TRAVIS_MESSAGE" "<!here> Failed to trigger deb and rpm package build during nightly release" "${NOTIF_CHANNEL}"