1
0
mirror of https://github.com/netdata/netdata.git synced 2021-06-06 23:03:21 +03:00
Files
netdata/.travis/draft_release.sh
Paul Emm. Katsoulakis 7f3c5f6c01 netdata/packaging/ci: Create manual nightly deployment tool (#5899)
* netdata/packaging/ci: Create manual nightly deployment tool

1. Alter docker tools to shebang with /usr/bin/env, safer to detect the right BASH (>4.0)
2. Generate script packaging/manual_nightly_deployment.sh, that runs only from TLD of netdata GIT
   and provides the means to deploy to docker and GCS the latest nightly build of netdata.
   Only option passed to the script is whether you want to deploy in docker, gcs or both.
   Note: for GCS deployment the user has to define which bucket to update.
   Note2: this tool has a hard dependency on gsutil to be properly setup on the development environment

* netdata/packaging/ci: Do not change global config for mail and user

Since we are now starting to use these scripts externally, we need to make sure we dont mess developer config.
It seems that we are touching global config, in an attempt to modify a single commit message.
Alter this and instead use the --author option for the single commit that we care about instead of altering the universe

Cheers
2019-05-03 15:24:45 +03:00

66 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
#
# Draft release generator.
# This utility is responsible for submitting a draft release to github repo
# It is agnostic of other processes, when executed it will draft a release,
# based on the most recent reachable tag.
#
# Requirements:
# - GITHUB_TOKEN variable set with GitHub token. Access level: repo.public_repo
# - artifacts directory in place
# - The directory is created by create_artifacts.sh mechanism
# - The artifacts need to be created with the same tag, obviously
#
# Copyright: SPDX-License-Identifier: GPL-3.0-or-later
#
# Author: Pavlos Emm. Katsoulakis <paul@netdata.cloud>
set -e
if [ ! -f .gitignore ]; then
echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
exit 1
fi
echo "--- Initialize git configuration ---"
git checkout master
git pull
if [[ $(git describe) =~ -rc* ]]; then
echo "This is a release candidate tag, we do not generate a release draft"
exit 0
fi
# Load the tag, if any
GIT_TAG=$(git describe)
if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then
echo "Beta mode on ${TRAVIS_REPO_SLUG}, i was about to run for release (${GIT_TAG}), but i am emulating, so bye"
exit 0
fi;
echo "---- CREATING RELEASE DRAFT WITH ASSETS -----"
# 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"
export PATH=$PATH:"/tmp/hub-linux-amd64-${HUB_VERSION}/bin"
# Create a release draft
if [ -z ${GIT_TAG+x} ]; then
echo "Variable GIT_TAG is not set. Something went terribly wrong! Exiting."
exit 1
fi
if [ "${GIT_TAG}" != "$(git tag --points-at)" ]; then
echo "ERROR! Current commit is not tagged. Stopping release creation."
exit 1
fi
until hub release create --draft \
-a "artifacts/netdata-${GIT_TAG}.tar.gz" \
-a "artifacts/netdata-${GIT_TAG}.gz.run" \
-a "artifacts/sha256sums.txt" \
-m "${GIT_TAG}" "${GIT_TAG}"; do
sleep 5
done