From f13f3c71c7cd448347b2f0ea4a1e85d3fce7f81e Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Wed, 12 Feb 2025 13:54:28 +0100 Subject: [PATCH] Solaris Userland CLI utils --- bin/lib/logging.sh | 41 +++++++++++++++++++++++++++++++++++++++++ bin/ul11u4_build.sh | 41 +++++++++++++++++++++++++++++++++++++++++ bin/ul11u4_gate_open.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 bin/lib/logging.sh create mode 100755 bin/ul11u4_build.sh create mode 100755 bin/ul11u4_gate_open.sh diff --git a/bin/lib/logging.sh b/bin/lib/logging.sh new file mode 100644 index 0000000..1942092 --- /dev/null +++ b/bin/lib/logging.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# exec &> >(tee -a "${SYSLOG}") +# exec &> >(tee -a "${APPLOG}") + +trap 'exit 1' HUP INT QUIT TERM + +log::prefix() { + date=$(gdate '+%Y-%m-%d %H:%M:%S,%3N') + printf '%s %s\n' "${date}" "${*}" +} + +log::notice() { + log::info "==> ${*}" +} + +log::info() { + log::prefix "INFO ${*}" +} + +log::debug() { + log::prefix "DEBUG ${*}" +} + +log::warning() { + log::prefix "WARNING ${*}" +} + +log::error() { + log::prefix "ERROR ${*}" >&2 +} + +log::fatal() { + reason='Unknown or not specified' + if [ "$1" ]; then + reason=$1 + fi + log::error "Fatal error. Reason: ${reason}" + kill -s TERM $$ +} + diff --git a/bin/ul11u4_build.sh b/bin/ul11u4_build.sh new file mode 100755 index 0000000..25524cc --- /dev/null +++ b/bin/ul11u4_build.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +source lib/logging.sh + +TARGET=$1 + + +if [ -z "$TARGET" ]; +then + log::fatal "No target specified on command line" +fi + +log::info"Starting build for for Ul11u4SRU" +log::info "Target: \"${TARGET}\"" + +JENKINS_TOKEN='1154eb0158729a7d326c1db13e7dca0cea' +JENKINS_SERVER='http://mrshughes.us.oracle.com/jenkins/' + +JOB_URL="${JENKINS_SERVER}/job/Solaris_11/job/11.4/job/userland-sru/job/userland-sru-build-11.4/buildWithParameters" + +log::info "Using '${JOB_URL}'" + +set -x +curl -X POST "${JOB_URL}" \ + --user "pnyc:${JENKINS_TOKEN}" \ + --data-urlencode "Build_Label=${TARGET}" \ + --data-urlencode "hguser=petr.nyc@oracle.com" \ + --data-urlencode "dryrun=false" \ + --data-urlencode "verbose=true" \ + --data-urlencode "debug=true" \ + --data-urlencode "scriptdir=./solaris/userland/sru/" \ + --data-urlencode "do_check_sru_cbe=true" \ + --data-urlencode "prepare_work_area=true" \ + --data-urlencode "do_build=true" \ + --data-urlencode "prepare_delivery=true" \ + --data-urlencode "create_escrow=true" \ + --data-urlencode "create_foss=true" \ + --data-urlencode "delivery=true" + +log::info "The job will be started here:" +log::info " ${JOB_URL%%buildWith*}" diff --git a/bin/ul11u4_gate_open.sh b/bin/ul11u4_gate_open.sh new file mode 100755 index 0000000..327f5e9 --- /dev/null +++ b/bin/ul11u4_gate_open.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC1091,SC2015 + +[[ "$0" == /* ]] && typeset -r PRG=$0 || typeset -r PRG=$PWD/$0 + +BINDIR=$(dirname "$PRG") +typeset -r BINDIR + +source "${BINDIR}/lib/logging.sh" + +TARGET=$1 + + +if [ -z "$TARGET" ]; +then + log::fatal "No target specified on command line" +fi + +log::debug "Starting gate open for Ul11u4SRU" +log::debug "Target: \"${TARGET}\"" + +JENKINS_TOKEN='1154eb0158729a7d326c1db13e7dca0cea' +JENKINS_SERVER='http://mrshughes.us.oracle.com/jenkins/' + +JOB_URL="${JENKINS_SERVER}/job/Solaris_11/job/11.4/job/userland-sru/job/userland-sru-gate-open-11.4/buildWithParameters" + +log::info "Using '${JOB_URL}'" + +curl -X POST "${JOB_URL}" \ + --user "pnyc:${JENKINS_TOKEN}" \ + --data-urlencode "Build_Label=${TARGET}" \ + --data-urlencode "hguser=petr.nyc@oracle.com" \ + --data-urlencode "dryrun=false" \ + --data-urlencode "verbose=true" \ + --data-urlencode "debug=true" \ + --data-urlencode "scriptdir=./solaris/userland/sru/" \ + --data-urlencode "do_gate_open=true" + +log::info "The job will be started here:" +log::info " ${JOB_URL%%buildWith*}"