-
Notifications
You must be signed in to change notification settings - Fork 1
/
pre_curate_docker.yml
51 lines (49 loc) · 2.64 KB
/
pre_curate_docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
resources:
- name: curatedocker
type: IncomingWebhook
configuration:
webhookName: curate_docker
# - name: mygitrepo
# type: GitRepo
# configuration:
# gitProvider: Github_Sample
# path: shimib/curation_pre
# branches:
# include: main
pipelines:
- name: CurateDocker
steps:
- name: ExampleStep
type: Bash
configuration:
integrations:
- name: artifactory
inputResources:
- name: curatedocker
- name: mygitrepo
trigger: false
execution:
onExecute:
#- docker login -u `echo "${int_artifactory_user}"` -p `echo "${int_artifactory_apikey}"` `echo "${int_artifactory_url}" | sed -E 's/.*\/\/([^\/]+).*/\1/'`
#- echo `echo "${int_artifactory_url}" | sed -E 's/.*\/\/([^\/]+).*/\1/'`
#- echo "$res_curatedocker_payload" | jq '.' > payload.json
#- echo `read_json payload.json "image"`
#- image="$(read_json payload.json 'image')"
#- artPath="$(echo $image | sed -E 's/[^\/]+\/([^:]+):(.*)$/\1\/\2/')"
#- artBase="$(echo $artPath | sed -E 's/([^/]+)\/(.*)\/[^/]+$/\1-cache\/\2/')"
#- artImageBase="$(echo $artBase | sed -E 's/[^/]+\/(.*)+$/\1/')"
#- image_tag="$(echo $artPath | sed -E 's/.*\/([^/]+)$/\1/')"
#- echo "artPath $artPath"
#- dockerpulloutput="$(docker pull $image 2>&1 || true)"
#- echo "${dockerpulloutput}"
#- add_run_variables image="$image"
#- xrayblocked=$(echo "$dockerpulloutput" | grep -c "Xray" || true)
#- echo "${xrayblocked}"
#- if [ $xrayblocked -eq 0 ]; then add_run_variables curate="yes"; else add_run_variables curate="no"; fi
#- if [ "$curate" = "yes" ]; then curate_image="$(curl -u${int_artifactory_user}:${int_artifactory_apikey} ${int_artifactory_url}/${artPath}/list.manifest.json | jq -r '.manifests[] | select(.platform.architecture | contains("amd64")) | "sha256__" + (.digest | sub("^sha256:"; "")) ')"; fi
#- if [ "$curate" = "yes" ]; then curl -XPOST -u${int_artifactory_user}:${int_artifactory_apikey} ${int_artifactory_url}/api/copy/${artBase}/${curate_image}?to=/shimi-curated/${artImageBase}/${curate_image} ; fi
#- if [ "$curate" = "yes" ]; then curl -XPOST -u${int_artifactory_user}:${int_artifactory_apikey} ${int_artifactory_url}/api/copy/${artBase}/${image_tag}?to=/shimi-curated/${artImageBase}/${image_tag} ; fi
- python3 --version
- ls -lR
- cp ./dependencyState/resources/mygitrepo/curate_docker.py .
- python3 curate_docker.py