File tree Expand file tree Collapse file tree 4 files changed +14
-44
lines changed
Expand file tree Collapse file tree 4 files changed +14
-44
lines changed Original file line number Diff line number Diff line change 5757
5858 render = ''
5959 declare manifest_path="$PRJ_DATA_HOME/${ manifest_path } "
60- _render () {
60+ render () {
6161 echo "Buiding manifests..."
6262 echo
6363 rm -rf "$manifest_path"
64+ mkdir -p "$manifest_path"
6465 ln -sf "${ manifestsWithGitRevision target } " "$manifest_path"
6566 echo
6667 echo "Manifests built in: $manifest_path"
6768 }
68- render() {
69- local mode="$1"
70- mkdir -p "$manifest_path"
71- if [[ "$mode" == "always" ]]
72- then
73- _render
74- elif [[ "$mode" == "current-revision" ]] \
75- && [[ "$(jq -r '.metadata.labels.revision' "$(find "$manifest_path" | head -n1)")" != "$(git rev-parse --short HEAD)" ]]
76- then
77- _render
78- elif [[ "$mode" == "if-not-exists" ]] && [[ ! -d "$manifest_path" ]]
79- then
80- _render
81- fi
82- }
8369 '' ;
8470 in [
8571 /*
8975 */
9076 ( mkCommand currentSystem "render" "Build the JSON manifests" [ ] ''
9177 ${ render }
92- render always
78+ render
9379 '' { } )
9480 ( mkCommand currentSystem "apply" "Apply the manifests to K8s" [ pkgs . kubectl pkgs . jq ] ''
9581 ${ render }
96- render if-not-exists
97- render current-revision
82+ render
9883
9984 diff() {
10085 if ! [[ -v CI ]]; then
Original file line number Diff line number Diff line change 4545 builtins . toFile "${ job_name } .json" ( builtins . unsafeDiscardStringContext ( builtins . toJSON { inherit job ; } ) ) ;
4646 render = ''
4747 declare job_path="$PRJ_DATA_HOME/${ job_path } "
48- _render () {
48+ render () {
4949 echo "Rendering to $job_path..."
5050 rm -rf "$job_path"
5151 ln -sf "${ jobWithGitRevision target } " "$job_path"
5252 if status=$(nomad validate "$job_path"); then
5353 echo "$status for $job_path"
5454 fi
5555 }
56- render() {
57- local mode="$1"
58- if [[ "$mode" == "always" ]]
59- then
60- _render
61- elif [[ "$mode" == "current-revision" ]] \
62- && [[ "$(jq -r '.job[].meta.rev' "$job_path")" != "$(git rev-parse --short HEAD)" ]]
63- then
64- _render
65- elif [[ "$mode" == "if-not-exists" ]] && [[ ! -h "$job_path" ]]
66- then
67- _render
68- fi
69- }
7056 '' ;
7157 in [
7258 /*
7662 */
7763 ( mkCommand currentSystem "render" "build the JSON job description" [ pkgs . nomad ] ''
7864 ${ render }
79- render always
65+ render
8066 '' { } )
8167 ( mkCommand currentSystem "deploy" "Deploy the job to Nomad" [ pkgs . nomad pkgs . jq ] ''
8268 ${ render }
83- render if-not-exists
84- render current-revision
69+ render
8570 if ! plan_results=$(nomad plan -force-color "$job_path"); then
8671 echo "$plan_results"
8772 run() { echo "$plan_results" | grep 'nomad job run -check-index'; }
9277 '' { } )
9378 ( mkCommand currentSystem "explore" "interactively explore the Job defintion" [ pkgs . nomad pkgs . fx ] ''
9479 ${ render }
95- render always
80+ render
9681 fx "$job_path"
9782 '' { } )
9883 ] ;
You can’t perform that action at this time.
0 commit comments