Skip to content

Commit

Permalink
merge run_pipeline and templatize
Browse files Browse the repository at this point in the history
  • Loading branch information
janboll committed Dec 20, 2024
1 parent e4de8fe commit 0837ac7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 129 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ services_all = $(join services_svc,services_mgmt)
services_svc_pipelines = frontend
%.deploy:
$(eval export dirname=$(subst .,/,$(basename $@)))
./run_pipeline.sh $(DEPLOY_ENV) ./$(dirname)/pipeline.yaml deploy -c public
./templatize.sh $(DEPLOY_ENV) -p ./$(dirname)/pipeline.yaml -s deploy -P run -c public

services_svc_pipelines = frontend
%.dry_run:
$(eval export dirname=$(subst .,/,$(basename $@)))
./run_pipeline.sh $(DEPLOY_ENV) ./$(dirname)/pipeline.yaml deploy -c public -d
./templatize.sh $(DEPLOY_ENV) ./$(dirname)/pipeline.yaml -s deploy -P run -c public -d

services_svc_all = $(join services_svc, services_svc_pipelines)

Expand Down
125 changes: 0 additions & 125 deletions run_pipeline.sh

This file was deleted.

24 changes: 22 additions & 2 deletions templatize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ CLOUD="${CLOUD:-public}"
REGION="${REGION:-westus3}"
CXSTAMP="${CXSTAMP:-1}"
EXTRA_ARGS=""
PIPELINE_MODE="inspect"
DRY_RUN=""

# Function to display usage
usage() {
echo "Usage: $0 deploy_env input output [-c cloud] [-r region] [-x cxstamp] [-e]"
echo " deploy_env Deployment environment"
echo " input Optional input file"
echo " output Optional output file"
echo " -d Dry run"
echo " -i Set the input file same as second arg"
echo " -o Set the output file same as third arg"
echo " -c Set the cloud (default: public)"
Expand Down Expand Up @@ -45,11 +48,14 @@ if [ "$#" -ge 1 ] && [[ ! "$1" =~ ^- ]]; then
fi

# Parse optional flags
while getopts "c:r:x:e:i:o:p:s:" opt; do
while getopts "c:dr:x:e:i:o:p:P:s:" opt; do
case ${opt} in
c)
CLOUD=${OPTARG}
;;
d)
DRY_RUN="--dry-run"
;;
r)
REGION=${OPTARG}
;;
Expand All @@ -68,6 +74,9 @@ while getopts "c:r:x:e:i:o:p:s:" opt; do
p)
PIPELINE=${OPTARG}
;;
P)
PIPELINE_MODE=${OPTARG}
;;
s)
PIPELINE_STEP=${OPTARG}
;;
Expand Down Expand Up @@ -127,7 +136,7 @@ if [ -n "$INPUT" ] && [ -n "$OUTPUT" ]; then
--input=${INPUT} \
--output=${OUTPUT} \
${EXTRA_ARGS}
elif [ -n "$PIPELINE" ] && [ -n "$PIPELINE_STEP" ]; then
elif [ $PIPELINE_MODE == "inspect" ] && [ -n "$PIPELINE" ] && [ -n "$PIPELINE_STEP" ]; then
$TEMPLATIZE pipeline inspect \
--config-file=${CONFIG_FILE} \
--cloud=${CLOUD} \
Expand All @@ -139,6 +148,17 @@ elif [ -n "$PIPELINE" ] && [ -n "$PIPELINE_STEP" ]; then
--step=${PIPELINE_STEP} \
--scope vars \
--format makefile
elif [ $PIPELINE_MODE == "run" ] && [ -n "$PIPELINE" ] && [ -n "$PIPELINE_STEP" ]; then
$TEMPLATIZE pipeline run \
--config-file=${CONFIG_FILE} \
--cloud=${CLOUD} \
--deploy-env=${DEPLOY_ENV} \
--region=${REGION} \
--region-short=${REGION_STAMP} \
--stamp=${CXSTAMP} \
--pipeline-file=${PIPELINE} \
--step=${PIPELINE_STEP} \
${DRY_RUN}
else
$TEMPLATIZE inspect \
--config-file=${CONFIG_FILE} \
Expand Down

0 comments on commit 0837ac7

Please sign in to comment.