-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: deploy pipelines in batch from directory rather than from file
- Loading branch information
1 parent
b1224da
commit e1a0486
Showing
2 changed files
with
19 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
#!/bin/bash -e | ||
|
||
path_to_pipeline_template=$1 | ||
path_to_pipeline_templates_directory=$1 | ||
path_to_pipeline_templates_directory="${path_to_pipeline_templates_directory%/}" | ||
|
||
region=$(grep 'region' scheduled_pipelines_config.yaml | sed -n 's/.*region:[^a-zA-Z0-9-]*\([a-zA-Z0-9-]*\).*/\1/p') | ||
project_id=$(grep 'id' scheduled_pipelines_config.yaml | sed -n 's/.*id:[^a-zA-Z0-9-]*\([a-zA-Z0-9-]*\).*/\1/p') | ||
repository_name=$(grep 'repository_name' scheduled_pipelines_config.yaml | sed -n 's/.*repository_name:[^a-zA-Z0-9-]*\([a-zA-Z0-9-]*\).*/\1/p') | ||
|
||
echo "Uploading pipeline template to Artifact Registry (${region}-kfp.pkg.dev/${project_id}/${repository_name})..." | ||
echo "Artifact Registry: ${region}-kfp.pkg.dev/${project_id}/${repository_name}" | ||
|
||
curl -X POST \ | ||
-H "Authorization: Bearer $(gcloud auth print-access-token)" \ | ||
-F tags=latest \ | ||
-F content=@${path_to_pipeline_template} \ | ||
https://${region}-kfp.pkg.dev/${project_id}/${repository_name} | ||
|
||
echo "Pipeline template ${path_to_pipeline_template} successfully uploaded to Artifact Registry!" | ||
for template_file in $path_to_pipeline_templates_directory/*.yaml; do | ||
if [ ! -f "$template_file" ]; then | ||
echo "No pipeline template found in $path_to_pipeline_templates_directory" | ||
exit 1 | ||
else | ||
echo "Uploading pipeline template $template_file..." | ||
curl -X POST \ | ||
-H "Authorization: Bearer $(gcloud auth print-access-token)" \ | ||
-F tags=latest \ | ||
-F content=@${template_file} \ | ||
https://${region}-kfp.pkg.dev/${project_id}/${repository_name} | ||
fi | ||
done |