Skip to content

Commit 7527318

Browse files
authored
Merge pull request opendatahub-io#212 from HumairAK/artifact_fix
Add push artifact work around.
2 parents 7f70d19 + 08eb98d commit 7527318

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed

config/internal/apiserver/artifact_script.yaml.tmpl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ data:
33
artifact_script: |-
44
#!/usr/bin/env sh
55
push_artifact() {
6-
if [ -f "$2" ]; then
7-
tar -cvzf $1.tgz $2
8-
aws s3 --endpoint {{.ObjectStorageConnection.Endpoint}} cp $1.tgz s3://{{.ObjectStorageConnection.Bucket}}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
6+
workspace_dir=$(echo $(context.taskRun.name) | sed -e "s/$(context.pipeline.name)-//g")
7+
workspace_dest=/workspace/${workspace_dir}/artifacts/$(context.pipelineRun.name)/$(context.taskRun.name)
8+
artifact_name=$(basename $2)
9+
if [ -f "$workspace_dest/$artifact_name" ]; then
10+
echo sending to: ${workspace_dest}/${artifact_name}
11+
tar -cvzf $1.tgz -C ${workspace_dest} ${artifact_name}
12+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
13+
elif [ -f "$2" ]; then
14+
tar -cvzf $1.tgz -C $(dirname $2) ${artifact_name}
15+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
916
else
1017
echo "$2 file does not exist. Skip artifact tracking for $1"
1118
fi

controllers/testdata/declarative/case_0/expected/created/configmap_artifact_script.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ data:
33
artifact_script: |-
44
#!/usr/bin/env sh
55
push_artifact() {
6-
if [ -f "$2" ]; then
7-
tar -cvzf $1.tgz $2
8-
aws s3 --endpoint http://minio-testdsp0.default.svc.cluster.local:9000 cp $1.tgz s3://mlpipeline/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
6+
workspace_dir=$(echo $(context.taskRun.name) | sed -e "s/$(context.pipeline.name)-//g")
7+
workspace_dest=/workspace/${workspace_dir}/artifacts/$(context.pipelineRun.name)/$(context.taskRun.name)
8+
artifact_name=$(basename $2)
9+
if [ -f "$workspace_dest/$artifact_name" ]; then
10+
echo sending to: ${workspace_dest}/${artifact_name}
11+
tar -cvzf $1.tgz -C ${workspace_dest} ${artifact_name}
12+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
13+
elif [ -f "$2" ]; then
14+
tar -cvzf $1.tgz -C $(dirname $2) ${artifact_name}
15+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
916
else
1017
echo "$2 file does not exist. Skip artifact tracking for $1"
1118
fi

controllers/testdata/declarative/case_2/expected/created/configmap_artifact_script.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ data:
33
artifact_script: |-
44
#!/usr/bin/env sh
55
push_artifact() {
6-
if [ -f "$2" ]; then
7-
tar -cvzf $1.tgz $2
8-
aws s3 --endpoint http://minio-testdsp2.default.svc.cluster.local:9000 cp $1.tgz s3://mlpipeline/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
6+
workspace_dir=$(echo $(context.taskRun.name) | sed -e "s/$(context.pipeline.name)-//g")
7+
workspace_dest=/workspace/${workspace_dir}/artifacts/$(context.pipelineRun.name)/$(context.taskRun.name)
8+
artifact_name=$(basename $2)
9+
if [ -f "$workspace_dest/$artifact_name" ]; then
10+
echo sending to: ${workspace_dest}/${artifact_name}
11+
tar -cvzf $1.tgz -C ${workspace_dest} ${artifact_name}
12+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
13+
elif [ -f "$2" ]; then
14+
tar -cvzf $1.tgz -C $(dirname $2) ${artifact_name}
15+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
916
else
1017
echo "$2 file does not exist. Skip artifact tracking for $1"
1118
fi

controllers/testdata/declarative/case_4/expected/created/configmap_artifact_script.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ data:
33
artifact_script: |-
44
#!/usr/bin/env sh
55
push_artifact() {
6-
if [ -f "$2" ]; then
7-
tar -cvzf $1.tgz $2
8-
aws s3 --endpoint http://minio-testdsp4.default.svc.cluster.local:9000 cp $1.tgz s3://mlpipeline/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
6+
workspace_dir=$(echo $(context.taskRun.name) | sed -e "s/$(context.pipeline.name)-//g")
7+
workspace_dest=/workspace/${workspace_dir}/artifacts/$(context.pipelineRun.name)/$(context.taskRun.name)
8+
artifact_name=$(basename $2)
9+
if [ -f "$workspace_dest/$artifact_name" ]; then
10+
echo sending to: ${workspace_dest}/${artifact_name}
11+
tar -cvzf $1.tgz -C ${workspace_dest} ${artifact_name}
12+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
13+
elif [ -f "$2" ]; then
14+
tar -cvzf $1.tgz -C $(dirname $2) ${artifact_name}
15+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
916
else
1017
echo "$2 file does not exist. Skip artifact tracking for $1"
1118
fi

controllers/testdata/declarative/case_5/expected/created/configmap_artifact_script.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ data:
33
artifact_script: |-
44
#!/usr/bin/env sh
55
push_artifact() {
6-
if [ -f "$2" ]; then
7-
tar -cvzf $1.tgz $2
8-
aws s3 --endpoint http://minio-testdsp5.default.svc.cluster.local:9000 cp $1.tgz s3://mlpipeline/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
6+
workspace_dir=$(echo $(context.taskRun.name) | sed -e "s/$(context.pipeline.name)-//g")
7+
workspace_dest=/workspace/${workspace_dir}/artifacts/$(context.pipelineRun.name)/$(context.taskRun.name)
8+
artifact_name=$(basename $2)
9+
if [ -f "$workspace_dest/$artifact_name" ]; then
10+
echo sending to: ${workspace_dest}/${artifact_name}
11+
tar -cvzf $1.tgz -C ${workspace_dest} ${artifact_name}
12+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
13+
elif [ -f "$2" ]; then
14+
tar -cvzf $1.tgz -C $(dirname $2) ${artifact_name}
15+
aws s3 --endpoint ${ARTIFACT_ENDPOINT} cp $1.tgz s3://${ARTIFACT_BUCKET}/artifacts/$PIPELINERUN/$PIPELINETASK/$1.tgz
916
else
1017
echo "$2 file does not exist. Skip artifact tracking for $1"
1118
fi

0 commit comments

Comments
 (0)