Last active
July 17, 2023 20:54
-
-
Save HumairAK/47fc1aceb3933b0647e3a9c7753edd0d to your computer and use it in GitHub Desktop.
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
kind: ConfigMap | |
apiVersion: v1 | |
metadata: | |
name: custom-script | |
labels: | |
app: ds-pipeline-sample | |
component: data-science-pipelines | |
data: | |
artifact_script: |- | |
#!/usr/bin/env sh | |
push_artifact() { | |
workspace_dir=$(echo $(context.taskRun.name) | sed -e "s/$(context.pipeline.name)-//g") | |
workspace_dest=/workspace/${workspace_dir}/artifacts/$(context.pipelineRun.name)/$(context.taskRun.name) | |
artifact_name=$(basename $2) | |
if [ -f "$workspace_dest/$artifact_name" ]; then | |
echo sending to: ${workspace_dest}/${artifact_name} | |
tar -cvzf $1.tgz -C ${workspace_dest} ${artifact_name} | |
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz | |
elif [ -f "$2" ]; then | |
tar -cvzf $1.tgz -C $(dirname $2) ${artifact_name} | |
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz | |
else | |
echo "$2 file does not exist. Skip artifact tracking for $1" | |
fi | |
} | |
push_log() { | |
cat /var/log/containers/$PODNAME*$NAMESPACE*step-main*.log > step-main.log | |
push_artifact main-log step-main.log | |
} | |
strip_eof() { | |
if [ -f "$2" ]; then | |
awk 'NF' $2 | head -c -1 > $1_temp_save && cp $1_temp_save $2 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment