diff options
-rw-r--r-- | .travis.yml | 10 | ||||
-rwxr-xr-x | .travis/labeler.sh | 84 | ||||
-rw-r--r-- | installer/netdata-updater.sh | 2 |
3 files changed, 71 insertions, 25 deletions
diff --git a/.travis.yml b/.travis.yml index c382017ee6..0fcea8b3d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,11 @@ jobs: depth: false - stage: nightlies - name: tarball and self-extractor build + name: docker images + install: sudo apt update -y && sudo apt install -y --only-upgrade docker-ce && docker info + script: "packaging/docker/build.sh" + env: REPOSITORY="netdata/netdata" + - name: tarball and self-extractor build install: sudo apt-get install -y gnupg libcap2-bin zlib1g-dev uuid-dev fakeroot script: ".travis/create_artifacts.sh" deploy: @@ -66,10 +70,6 @@ jobs: skip_cleanup: true file_glob: true file: "netdata*.tar.gz" - - name: docker images - install: sudo apt update -y && sudo apt install -y --only-upgrade docker-ce && docker info - script: "packaging/docker/build.sh" - env: REPOSITORY="netdata/netdata" - name: changelog generation script: ".travis/generate_changelog.sh" env: COMMIT_AND_PUSH=1 diff --git a/.travis/labeler.sh b/.travis/labeler.sh index 770b2f747c..50c77cc500 100755 --- a/.travis/labeler.sh +++ b/.travis/labeler.sh @@ -4,30 +4,76 @@ # It will soon be deprecated by GitHub Actions so no futher development on it is planned. if [ "$GITHUB_TOKEN" == "" ]; then - echo "GITHUB_TOKEN is needed" - exit 1 + echo "GITHUB_TOKEN is needed" + exit 1 fi # Download hub -HUB_VERSION=${HUB_VERSION:-"2.5.1"} -wget "https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz" -O "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" -tar -C /tmp -xvf "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" &>/dev/null -export PATH=$PATH:"/tmp/hub-linux-amd64-${HUB_VERSION}/bin" +if ! [ -x "$(command -v hub)" ]; then + HUB_VERSION=${HUB_VERSION:-"2.5.1"} + wget "https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz" -O "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" + tar -C /tmp -xvf "/tmp/hub-linux-amd64-${HUB_VERSION}.tgz" &>/dev/null + export PATH=$PATH:"/tmp/hub-linux-amd64-${HUB_VERSION}/bin" +fi echo "Looking up available labels" -LABELS_FILE=/tmp/exclude_labels -hub issue labels > $LABELS_FILE +LABELS_FILE=/tmp/labels +hub issue labels >$LABELS_FILE for STATE in "open" "closed"; do - for ISSUE in $(hub issue -f "%I %l%n" -s "$STATE" -d "$(date +%F -d '1 day ago')" | grep -v -f $LABELS_FILE); do - echo "Processing $STATE issue no. $ISSUE" - URL="https://api.github.com/repos/netdata/netdata/issues/$ISSUE" - BODY="$(curl "${URL}" | jq .body 2>/dev/null)" - case "${BODY}" in - *"# Question summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["question"]}' -X PATCH "${URL}" ;; - *"# Bug report summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage","bug"]}' -X PATCH "${URL}" ;; - *"# Feature idea summary"* ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage","feature request"]}' -X PATCH "${URL}" ;; - * ) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage"]}' -X PATCH "${URL}" ;; - esac - done + for ISSUE in $(hub issue -f "%I %l%n" -s "$STATE" -d "$(date +%F -d '1 day ago')" | grep -v -f $LABELS_FILE); do + echo "Processing $STATE issue no. $ISSUE" + URL="https://api.github.com/repos/netdata/netdata/issues/$ISSUE" + BODY="$(curl "${URL}" 2>/dev/null | jq .body)" + case "${BODY}" in + *"# Question summary"*) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["question"]}' -X PATCH "${URL}" ;; + *"# Bug report summary"*) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage","bug"]}' -X PATCH "${URL}" ;; + *"# Feature idea summary"*) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage","feature request"]}' -X PATCH "${URL}" ;; + *) curl -H "Authorization: token $GITHUB_TOKEN" -d '{"labels":["needs triage"]}' -X PATCH "${URL}" ;; + esac + done +done + +NEW_LABELS=/tmp/new_labels +for PR in $(hub pr list -s all -f "%I %l%n" -L 10); do + echo "-------------------------------------------------------" + echo "Processing PR #$PR" + echo "" >$NEW_LABELS + NEW_SET="" + URL="https://api.github.com/repos/netdata/netdata/issues/$PR" + DIFF_URL="https://github.com/netdata/netdata/pull/$PR.diff" + for FILE in $(curl -L "${DIFF_URL}" 2>/dev/null | grep "diff --git a/" | cut -d' ' -f3 | sort | uniq); do + LABEL="" + case "${FILE}" in + *".md") AREA="docs" ;; + *"/collectors/python.d.plugin/"*) AREA="external/python" ;; + *"/collectors/charts.d.plugin/"*) AREA="external" ;; + *"/collectors/node.d.plugin/"*) AREA="external" ;; + *"/.travis"*) AREA="ci" ;; + *"/.github/"*) AREA="ci" ;; + *"/build/"*) AREA="packaging" ;; + *"/contrib/"*) AREA="packaging" ;; + *"/diagrams/"*) AREA="docs" ;; + *"/installer/"*) AREA="packaging" ;; + *"/makeself/"*) AREA="packaging" ;; + *"/system/"*) AREA="packaging" ;; + *"/netdata-installer.sh"*) AREA="packaging" ;; + *) AREA=$(echo "$FILE" | cut -d'/' -f2) ;; + esac + LABEL="area/$AREA" + echo "Selecting $LABEL due to $FILE" + if grep "$LABEL" "$LABELS_FILE"; then + echo "$LABEL" >>$NEW_LABELS + if [[ $LABEL =~ "external" ]]; then + echo "area/collectors" >>$NEW_LABELS + fi + else + echo "Label '$LABEL' not available" + fi + done + NEW_SET=$(sort $NEW_LABELS | uniq | grep -v "^$" | sed -e 's/^/"/g;s/$/",/g' | tr -d '\n' | sed 's/.\{1\}$//') + if [ ! -z "$NEW_SET" ]; then + echo "Assigning labels: ${NEW_SET}" + curl -H "Authorization: token $GITHUB_TOKEN" -d "{\"labels\":[${NEW_SET}]}" -X PATCH "${URL}" &>/dev/null + fi done diff --git a/installer/netdata-updater.sh b/installer/netdata-updater.sh index 94f3ac04b2..9ab0383e92 100644 --- a/installer/netdata-updater.sh +++ b/installer/netdata-updater.sh @@ -22,7 +22,7 @@ source installer/.environment.sh || exit 1 UID="$(id -u)" if [ "${INSTALL_UID}" != "${UID}" ] then - echo >&2 "This script should be run as user with uid ${INSTALL_UID} but it now runs with uid ${UID}" + echo >&2 "You are running this script as user with uid ${UID}. We recommend to run this script as root (user with uid 0)" exit 1 fi |