summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com>2019-04-18 07:55:58 +0300
committerGitHub <noreply@github.com>2019-04-18 07:55:58 +0300
commita8ba6234f6b8540be45dc34bde4d1078a985cc22 (patch)
tree5deaa9cbc13c3c6039f90a03dec31183923697f1 /tests
parent34e19574c1931ad3fc3a5abf162e74d4d444b41b (diff)
Pipeline redesign master (#5885)
* netdata/packaging/ci: [WIP] Redesign packaging release * netdata/packaging/ci: Add explicitly os definition, also remove sourcing of slack, its already done and rename before_install -> install * netdata/packaging/ci: fix stray stage name * netdata/packaging/ci: style * netdata/packaging/ci: fix syntax for yaml * netdata/packaging/ci: Try removing this, doesnt seem to make much sense to be there (for now) * Revert "netdata/packaging/ci: Try removing this, doesnt seem to make much sense to be there (for now)" This reverts commit ad5556a3ccf6c11ebc9026942af8013d4d0ea666. wow travis - this is weird * netdata/packaging/ci: a few more changes * netdata/packaging/ci: This is totally experimental, will adjust after i test it * netdata/packaging/ci: Reinstate original design - the problem i am trying to solve is more travis-related and fundamental on the way travis works * netdata/packaging/ci: i wonder.. * Revert "netdata/packaging/ci: i wonder.." This reverts commit a160df4fcac866375e8319bf200f47263b2bcaa3. * netdata/packaging/ci: Fix broken items * netdata/packaging/ci: docker images are built and published independently. As long as tagging has taken place earlier, during packaging * netdata/packaging/ci: Following hints from https://github.com/travis-ci/travis-ci/issues/4681 and the mayhem triggered from this change So we adding the compiler, to see if it will get travis to build the right matrix. then linter broke on addons for some weird reason, so remove addons->apt->update too * netdata/packaging/ci: Now do the rest of the changes, since with addition of compiler, things got worse * netdata/packaging/ci: Ok, as expected the workaround from them did not work. Lets get creative though and assume they exclude what they added, so lets do that for os * netdata/packaging/ci: test slack * netdata/packaging/ci: Bring the modified slack script on this branch * netdata/packaging/ci: Add a few more slack messages * Fix empty stage occurrence * netdata/packaging/ci: Another set of restructure changes, explained below 1) Publish release -> Publish for release (minor rename for clarity) 2) Add some more work on the make dist testing (temp folder for root and for now just validate the existence of the tarball) 3) Add some more slack notifications (that is still beta, will have to properly refine once we are done with changes of the flow) 4) Restructure the release process, finally a) relase.sh becomes draft_release.sh and changelog_and_tag_release.sh, basically splitting up the steps into meaningful independent blocks b) Adjust the pipeline, now we run 'changelog_and_tag_release.sh' to get the latest changelog and tag the release, then we run artifacts submission and draft release generation on github still more things to re-check on this step, it will become clearer once i get it up to speed to run on my local repos end to end * netdata/packaging/ci: Fix wrong path usage * netdata/packaging/ci: Update webhook URL * netdata/packaging/ci: Update stage config as proposed by the fix from travis team * netdata/packaging/ci: Another round of restructuring, after 1-1 comparison with old version Briefly: 1) Publish for release stage will only run when there is a TAG defined (To be tested though, but thats the idea). The code previously had the releaser.sh script that did exactly that, if tagger script failed, it would stop process. Now we have distributed the processing in clear chunks and we pick up the process based on shared info that travis or the environment provides 2) Rename <<Create release (only on special commit msg)>> to a more appropriate name, we are not really creating release there its more complicated 3) Move the labeler execution to the packaging step, since publishing now not happening all the time. Previously we hacked this by exit 0 with the tagger and allow the labeler (which was the second part of the execution) to run. 4) before_install in the publishing stage is wrong. We only need this as before_deploy before deploy execution. That is where we use it, really. 5) Rename changelog_and_tag_release.sh to generate_changelog_and_tag_release.sh, just to be clearer. No problem with slightly longer file names 6) Do not let generate_changelog_and_tag_release.sh execute if GIT_TAG is not defined, just exit quietly with a message and a success code 7) Remove the tagger from the generate_changelog_and_tag_release.sh, its confusing to shove it in there. Pull it out and let it run on a clear step from the pipeline but within the same machine to make sure it shares environment with generate_changelog_and_tag_release.sh (So it has to be within the same job) This is it mostly, keep in mind that the nightly and release parts are not tested yet. After this commit, there will be more code that will allow me to execute all the flows on my pipeline and fully test and adjust the workflows as needed * netdata/packaging/ci: Add more notifications, adjust the existing ones too * netdata/packaging/ci: Add safeguards for beta, do a rename too 1) rename generate_changelog.sh -> generate_changelog_for_nightlies.sh, just to provide clarity on the usage. Note: we will simplify this later, this was a workaround that raised a bug on release after refactoring nightlies. We will have to clean this up properly once we merge the new pipeline flow 2) Add checks based on TRAVIS_REPO_SLUG to identify when we running on personal repo and abort mission critical actions like deploying or generating changelogs Note: The deployment step for now will simply fail, due to the lack of the necessary encryption keys on the environment. At a later iteration, we should have beta buckets on GCS and also beta repositories on Docker to properly test our publishing capability on our beta stack * netdata/packaging/ci: Refactor README.md -- still half way there, will resume when i am done with testing * netdata/packaging/ci: At this stage make the scripts harder to run, add checks to bypass tested execution. * netdata/packaging/ci: Seems that adding the install tag within the stage, kind of overriding the outer install pull out install items from packaging to the main install, no point to isolate two packages, just install all required all the time * netdata/packaging/ci: tag obviously cant work at that step, moving it down to the jobs and i need to recheck if the syntax is applicable for travis too * netdata/packaging/ci: So the jobs in a list dont share the environment, lets see if we do it otherwise. also remove the tag check, not work as expected * netdata/packaging/ci: Add another way to check the RC condition * netdata/packaging/ci: experimental - check conditions on message * netdata/packaging/ci: Introduce an alternate master branch for the workflow testing 1. I created pipeline-redesign-master that will be the master branch for my use cases 2. Modified travis to trigger all production workflows on that branch, so that i can experiment freely with test commits to trigger process and verify execution flow * remove spaces * netdata/packaging/ci: comment out * netdata/packaging/ci: wording nit * netdata/packaging/ci: adjust the condition properly * netdata/packaging/ci: test condition for triggering on specific keywords * netdata/packaging/ci: try different syntax * netdata/packaging/ci: remove depth, causes problems as we dont get all required objects from repo (adds --depth 50 in clone) * Missing equal sign in regex? * netdata/packaging/ci: Update tagger script 1) More verbose messages 2) Update comments copyrights etc 3) Rename release_candidate to set_tag_release_candidate 4) Add curlies on the variables, also change the way we check for path * netdata/packaging/ci: reinstate git depth * netdata/packaging/ci: Remove git depth from packaging too * netdata/packaging/ci: RTFM - was using wrong syntax for slack @here approach * netdata/packaging/ci: Using install tag at the stage layer, overrides the global one for some reason. fix that * netdata/packaging/ci: Dont use the pattern matching from travis, do it outside with a script * netdata/packaging/ci: Do it the other way, script execution doesnt work there * netdata/packaging/ci: Attempt to fix conditional on release, remove the faulty assumptions as provided by travis team * netdata/packaging/ci: reintroduce the tag checking * netdata/packaging/ci: you need to bring tag checking at the stage, as it is calculated during packaging step * netdata/packaging/ci: you cant escape that one for the moment, merge them and we will rework it later again * netdata/packaging/ci: dont forget git depth * netdata/packaging/ci: [WIP] Redesign packaging release * netdata/packaging/ci: Add explicitly os definition, also remove sourcing of slack, its already done and rename before_install -> install * netdata/packaging/ci: fix stray stage name * netdata/packaging/ci: Try removing this, doesnt seem to make much sense to be there (for now) * Revert "netdata/packaging/ci: Try removing this, doesnt seem to make much sense to be there (for now)" * netdata/packaging/ci: Reinstate original design - the problem i am trying to solve is more travis-related and fundamental on the way travis works * netdata/packaging/ci: Fix broken items * netdata/packaging/ci: docker images are built and published independently. As long as tagging has taken place earlier, during packaging * netdata/packaging/ci: Following hints from https://github.com/travis-ci/travis-ci/issues/4681 and the mayhem triggered from this change So we adding the compiler, to see if it will get travis to build the right matrix. then linter broke on addons for some weird reason, so remove addons->apt->update too * netdata/packaging/ci: Now do the rest of the changes, since with addition of compiler, things got worse * netdata/packaging/ci: Ok, as expected the workaround from them did not work. Lets get creative though and assume they exclude what they added, so lets do that for os * netdata/packaging/ci: test slack * netdata/packaging/ci: Bring the modified slack script on this branch * netdata/packaging/ci: Add a few more slack messages * Fix empty stage occurrence * netdata/packaging/ci: Another set of restructure changes, explained below 1) Publish release -> Publish for release (minor rename for clarity) 2) Add some more work on the make dist testing (temp folder for root and for now just validate the existence of the tarball) 3) Add some more slack notifications (that is still beta, will have to properly refine once we are done with changes of the flow) 4) Restructure the release process, finally a) relase.sh becomes draft_release.sh and changelog_and_tag_release.sh, basically splitting up the steps into meaningful independent blocks b) Adjust the pipeline, now we run 'changelog_and_tag_release.sh' to get the latest changelog and tag the release, then we run artifacts submission and draft release generation on github still more things to re-check on this step, it will become clearer once i get it up to speed to run on my local repos end to end * netdata/packaging/ci: Fix wrong path usage * netdata/packaging/ci: Update webhook URL * netdata/packaging/ci: Update stage config as proposed by the fix from travis team * netdata/packaging/ci: Another round of restructuring, after 1-1 comparison with old version Briefly: 1) Publish for release stage will only run when there is a TAG defined (To be tested though, but thats the idea). The code previously had the releaser.sh script that did exactly that, if tagger script failed, it would stop process. Now we have distributed the processing in clear chunks and we pick up the process based on shared info that travis or the environment provides 2) Rename <<Create release (only on special commit msg)>> to a more appropriate name, we are not really creating release there its more complicated 3) Move the labeler execution to the packaging step, since publishing now not happening all the time. Previously we hacked this by exit 0 with the tagger and allow the labeler (which was the second part of the execution) to run. 4) before_install in the publishing stage is wrong. We only need this as before_deploy before deploy execution. That is where we use it, really. 5) Rename changelog_and_tag_release.sh to generate_changelog_and_tag_release.sh, just to be clearer. No problem with slightly longer file names 6) Do not let generate_changelog_and_tag_release.sh execute if GIT_TAG is not defined, just exit quietly with a message and a success code 7) Remove the tagger from the generate_changelog_and_tag_release.sh, its confusing to shove it in there. Pull it out and let it run on a clear step from the pipeline but within the same machine to make sure it shares environment with generate_changelog_and_tag_release.sh (So it has to be within the same job) This is it mostly, keep in mind that the nightly and release parts are not tested yet. After this commit, there will be more code that will allow me to execute all the flows on my pipeline and fully test and adjust the workflows as needed * netdata/packaging/ci: Add more notifications, adjust the existing ones too * netdata/packaging/ci: Add safeguards for beta, do a rename too 1) rename generate_changelog.sh -> generate_changelog_for_nightlies.sh, just to provide clarity on the usage. Note: we will simplify this later, this was a workaround that raised a bug on release after refactoring nightlies. We will have to clean this up properly once we merge the new pipeline flow 2) Add checks based on TRAVIS_REPO_SLUG to identify when we running on personal repo and abort mission critical actions like deploying or generating changelogs Note: The deployment step for now will simply fail, due to the lack of the necessary encryption keys on the environment. At a later iteration, we should have beta buckets on GCS and also beta repositories on Docker to properly test our publishing capability on our beta stack * netdata/packaging/ci: Refactor README.md -- still half way there, will resume when i am done with testing * netdata/packaging/ci: At this stage make the scripts harder to run, add checks to bypass tested execution. * netdata/packaging/ci: Seems that adding the install tag within the stage, kind of overriding the outer install pull out install items from packaging to the main install, no point to isolate two packages, just install all required all the time * netdata/packaging/ci: tag obviously cant work at that step, moving it down to the jobs and i need to recheck if the syntax is applicable for travis too * netdata/packaging/ci: So the jobs in a list dont share the environment, lets see if we do it otherwise. also remove the tag check, not work as expected * netdata/packaging/ci: Add another way to check the RC condition * netdata/packaging/ci: experimental - check conditions on message * netdata/packaging/ci: Introduce an alternate master branch for the workflow testing 1. I created pipeline-redesign-master that will be the master branch for my use cases 2. Modified travis to trigger all production workflows on that branch, so that i can experiment freely with test commits to trigger process and verify execution flow * remove spaces * netdata/packaging/ci: comment out * netdata/packaging/ci: wording nit * netdata/packaging/ci: adjust the condition properly * netdata/packaging/ci: test condition for triggering on specific keywords * netdata/packaging/ci: try different syntax * netdata/packaging/ci: remove depth, causes problems as we dont get all required objects from repo (adds --depth 50 in clone) * Missing equal sign in regex? * netdata/packaging/ci: Update tagger script 1) More verbose messages 2) Update comments copyrights etc 3) Rename release_candidate to set_tag_release_candidate 4) Add curlies on the variables, also change the way we check for path * netdata/packaging/ci: reinstate git depth * netdata/packaging/ci: Remove git depth from packaging too * netdata/packaging/ci: RTFM - was using wrong syntax for slack @here approach * netdata/packaging/ci: Using install tag at the stage layer, overrides the global one for some reason. fix that * netdata/packaging/ci: Dont use the pattern matching from travis, do it outside with a script * netdata/packaging/ci: Do it the other way, script execution doesnt work there * netdata/packaging/ci: Attempt to fix conditional on release, remove the faulty assumptions as provided by travis team * netdata/packaging/ci: reintroduce the tag checking * netdata/packaging/ci: you need to bring tag checking at the stage, as it is calculated during packaging step * netdata/packaging/ci: you cant escape that one for the moment, merge them and we will rework it later again * netdata/packaging/ci: dont forget git depth * netdata/packaging/ci: bring back the dist checking * netdata/packaging/ci: fix syntax * netdata/packaging/ci: no depth * netdata/packaging/ci: Introduce make dist validation tasks: Install from dist file and verify service is starting up * netdata/packaging/ci: Add a couple more information for troubleshooting * netdata/packaging/ci: Add extra information prior to executing crucial operations * netdata/packaging/ci: Make rm error soft here * netdata/packaging/ci: This is not needed here * netdata/packaging/ci: Prepare for beta stage deployment process - introduce a beta provider - adjust key decryption process, different keys for beta, different for prod - Enter conditions to deploy beta only on beta process and production only on production process - Use travis variables, to allow multiple users have beta stages for deployment, if they want * netdata/packaging/ci: add one more message * netdata/packaging/ci: Bring back naming to the actual master branch * netdata/packaging/ci: rename beta to dev * netdata/packaging/ci: Make permanent restrictions for some of the stricts, so that we don't mess things up * netdata/packaging/ci: Update README that was missed and also make sure git depth false is at the places needed * netdata/packaging/ci: fix codacy complaints
Diffstat (limited to 'tests')
-rwxr-xr-xtests/installer/slack.sh44
1 files changed, 41 insertions, 3 deletions
diff --git a/tests/installer/slack.sh b/tests/installer/slack.sh
index a5a17a7478..0549aa8889 100755
--- a/tests/installer/slack.sh
+++ b/tests/installer/slack.sh
@@ -2,7 +2,7 @@
# BASH Lib: Simple incoming webhook for slack integration.
#
# The script expects the following parameters to be defined by the upper layer:
-# SLACK_INCOMING_WEBHOOK_URL
+# SLACK_NOTIFY_WEBHOOK_URL
# SLACK_BOT_NAME
# SLACK_CHANNEL
#
@@ -11,6 +11,44 @@
# Author: Pavlos Emm. Katsoulakis <paul@netdata.cloud
post_message() {
- MESSAGE="$1"
- curl -X POST --data-urlencode "payload={\"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_BOT_NAME}\", \"text\": \"${MESSAGE}\", \"icon_emoji\": \":space_invader:\"}" ${SLACK_INCOMING_WEBHOOK_URL}
+ TYPE="$1"
+ MESSAGE="$2"
+
+ case "$TYPE" in
+ "PLAIN_MESSAGE")
+ curl -X POST --data-urlencode "payload={\"channel\": \"${SLACK_CHANNEL}\", \"username\": \"${SLACK_BOT_NAME}\", \"text\": \"${MESSAGE}\", \"icon_emoji\": \":space_invader:\"}" ${SLACK_NOTIFY_WEBHOOK_URL}
+ ;;
+ "TRAVIS_MESSAGE")
+ EVENT_LINE="${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}', on '${TRAVIS_OS_NAME}'"
+ if [ "$TRAVIS_EVENT_TYPE}" == "pull_request" ]; then
+ EVENT_LINE="${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}' #${TRAVIS_PULL_REQUEST}, on '${TRAVIS_OS_NAME}' "
+ fi
+
+ POST_MESSAGE="{
+ \"text\": \"${TRAVIS_REPO_SLUG}, ${MESSAGE}\",
+ \"attachments\": [{
+ \"text\": \"${TRAVIS_JOB_NUMBER}: Event type '${TRAVIS_EVENT_TYPE}', on '${TRAVIS_OS_NAME}' \",
+ \"fallback\": \"I could not determine the build\",
+ \"callback_id\": \"\",
+ \"color\": \"#3AA3E3\",
+ \"attachment_type\": \"default\",
+ \"actions\": [
+ {
+ \"name\": \"${TRAVIS_BUILD_NUMBER}\",
+ \"text\": \"Build #${TRAVIS_BUILD_NUMBER}\",
+ \"type\": \"button\",
+ \"url\": \"${TRAVIS_BUILD_WEB_URL}\"
+ },
+ {
+ \"name\": \"${TRAVIS_JOB_NUMBER}\",
+ \"text\": \"Job #${TRAVIS_JOB_NUMBER}\",
+ \"type\": \"button\",
+ \"url\": \"${TRAVIS_JOB_WEB_URL}\"
+ }]
+ }]
+ }"
+ echo "Sending ${POST_MESSAGE}"
+ curl -X POST --data-urlencode "payload=${POST_MESSAGE}" "${SLACK_NOTIFY_WEBHOOK_URL}"
+ ;;
+ esac
}