Skip to content

Commit 3974ffe

Browse files
authored
Merge pull request #227 from HumairAK/v1.0.x
Add push artifact work around.
2 parents ad8715f + 15e7b06 commit 3974ffe

File tree

6 files changed

+51
-16
lines changed

6 files changed

+51
-16
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM registry.redhat.io/ubi8/go-toolset:1.18.9-8 as builder
2+
FROM registry.access.redhat.com/ubi8/go-toolset:1.18.9-8 as builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

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)