diff --git a/ci/pipeline.yml b/ci/pipeline.yml index e4bffd8..d058784 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -22,7 +22,7 @@ meta: name: (( param "Please provide the git name for automated commits" )) go: - version: 1.9 + version: "1.10" module: (( concat "github.com/" meta.github.owner "/" meta.github.repo )) cmd_module: (( grab meta.go.module )) binary: (( grab meta.github.repo )) diff --git a/ci/repipe b/ci/repipe index 1390631..72653df 100755 --- a/ci/repipe +++ b/ci/repipe @@ -38,9 +38,40 @@ usage() { echo Command line arguments: echo "no-fly Do not execute any fly commands" echo "save-manifest Save manifest to file save-manifest" - echo "validate Validatei pipeline instead of set pipeline" + echo "validate Validate pipeline instead of set pipeline" echo "validate-strict Validate pipeline with strict mode" echo "non-interactive Run set-pipeline in non-interactive mode" + echo "open Open pipeline dashboard to browser (if possible)" +} + +open_pipeline() { + url=$(show_pipeline_url) + cleanup + if [[ -x /usr/bin/open ]]; then + exec /usr/bin/open "$url" + else + echo "Sorry, but I was not able to automagically open" + echo "your Concourse Pipeline in the browser." + echo + echo "Here's a link you can click on, though:" + echo + echo " $url" + echo + exit 0; + fi +} + +show_pipeline_url() { + spruce merge --skip-eval pipeline.yml ${settings_file} > .deploy.yml + concourse_url=$(spruce json .deploy.yml | jq -r ".meta.url") + team=$(spruce json .deploy.yml | jq -r ".meta.team // \"main\"") + pipeline=$(spruce merge --skip-eval \ + --cherry-pick meta.pipeline \ + --cherry-pick meta.name \ + .deploy.yml | spruce merge - | spruce json | jq -r ".meta.pipeline") + + echo "$concourse_url/teams/$team/pipelines/$pipeline" + exit 0 } for arg do @@ -50,6 +81,8 @@ for arg do validate) VALIDATE_PIPELINE="normal" ;; validate-strict|validate_strict) VALIDATE_PIPELINE="strict" ;; non-interactive|non_interactive) NON_INTERACTIVE="--non-interactive" ;; + url) SHOW_PIPELINE_URL="yes" ;; + open) OPEN_PIPELINE="yes" ;; help|-h|--help) usage; exit 0 ;; *) echo Invalid argument usage @@ -58,7 +91,7 @@ for arg do done cd $(dirname $BASH_SOURCE[0]) -echo "Working in $(pwd)" +echo >&2 "Working in $(pwd)" need_command spruce # Allow for target-specific settings @@ -73,6 +106,10 @@ echo >&2 "Using settings found in ${settings_file}" set -e trap "cleanup" QUIT TERM EXIT INT + +[[ -n ${SHOW_PIPELINE_URL} ]] && { show_pipeline_url; exit 0; } +[[ -n ${OPEN_PIPELINE} ]] && { open_pipeline; exit 0; } + spruce merge pipeline.yml ${settings_file} > .deploy.yml PIPELINE=$(spruce json .deploy.yml | jq -r '.meta.pipeline // ""') if [[ -z ${PIPELINE} ]]; then diff --git a/ci/settings.yml b/ci/settings.yml index 8dc7a49..499454f 100644 --- a/ci/settings.yml +++ b/ci/settings.yml @@ -7,7 +7,6 @@ meta: initial_version: 0.5.0 go: - version: "1.9" binary: eden cmd_module: .