-
Notifications
You must be signed in to change notification settings - Fork 8
/
get-env-containerd.sh
executable file
·80 lines (66 loc) · 2.53 KB
/
get-env-containerd.sh
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
# Script to get the date.list, the dockertest repository and the latest containerd packages if CONTAINERD_BUILD is set to 0
set -u
PATH_COS="/mnt"
PATH_PASSWORD="${PATH_SCRIPTS}/.s3fs_cos_secret"
COS_BUCKET_PRIVATE="ppc64le-docker"
URL_COS_PRIVATE="https://s3.us-south.cloud-object-storage.appdomain.cloud"
FILE_DATE="${PATH_SCRIPTS}/env/date.list"
PATH_DOCKERTEST="/workspace/test/src/github.ibm.com/powercloud"
# Copy the date file
cp ${FILE_DATE} /workspace/date.list
set -o allexport
source /workspace/env.list
source /workspace/date.list
# Mount the COS bucket if not mounted
if ! test -d ${PATH_COS}/s3_${COS_BUCKET_PRIVATE}
then
# Set up the s3 secret if not already configured
if ! test -f ${PATH_PASSWORD}
then
echo ":${S3_SECRET_AUTH}" > ${PATH_PASSWORD}
chmod 600 ${PATH_PASSWORD}
fi
mkdir -p ${PATH_COS}/s3_${COS_BUCKET_PRIVATE}
s3fs ${COS_BUCKET_PRIVATE} ${PATH_COS}/s3_${COS_BUCKET_PRIVATE} -o url=${URL_COS_PRIVATE} -o passwd_file=${PATH_PASSWORD} -o ibm_iam_auth
fi
# Copy the dockertest repo to the local /workspace
mkdir -p ${PATH_DOCKERTEST}
cp -r ${PATH_COS}/s3_${COS_BUCKET_PRIVATE}/prow-docker/dockertest ${PATH_DOCKERTEST}/dockertest
# Get the docker-ce packages
mkdir /workspace/docker-ce-${DOCKER_TAG}_${DATE}
cp -r ${PATH_COS}/s3_${COS_BUCKET_PRIVATE}/prow-docker/build-docker-${DOCKER_TAG}_${DATE}/docker-ce-${DOCKER_TAG}/* /workspace/docker-ce-${DOCKER_TAG}_${DATE}
# Get the containerd packages if CONTAINERD_BUILD=0
if [[ ${CONTAINERD_BUILD} = "0" ]]
then
echo "CONTAINERD_BUILD is set to 0, we copy the containerd packages from the COS bucket"
mkdir /workspace/containerd-${CONTAINERD_TAG}_${DATE}
cp -r ${PATH_COS}/s3_${COS_BUCKET_PRIVATE}/prow-docker/containerd-${CONTAINERD_TAG}/* /workspace/containerd-${CONTAINERD_TAG}_${DATE}
else
echo "CONTAINERD_BUILD is set to 1"
fi
# Check if we have the dockertest
if ! test -d ${PATH_DOCKERTEST}/dockertest
then
echo "The dockertest directory has not been copied."
exit 1
fi
# Check if we have the docker packages
if ! test -d /workspace/docker-ce-${DOCKER_TAG}_${DATE}
then
echo "The docker packages have not been copied."
exit 1
fi
# Check if we have the containerd packages if CONTAINERD_BUILD is 0
if [[ ${CONTAINERD_BUILD} = "0" ]]
then
if test -d /workspace/containerd-${CONTAINERD_TAG}
then
echo "The containerd packages have been copied."
else
echo "The containerd packages have not been copied."
exit 1
fi
else
echo "The dockertest directory has been copied."
fi