|
...
|
...
|
@@ -13,6 +13,7 @@ OS_ROOT=$(dirname "${BASH_SOURCE}")/../..
|
|
13
|
13
|
source "${OS_ROOT}/hack/util.sh"
|
|
14
|
14
|
source "${OS_ROOT}/hack/common.sh"
|
|
15
|
15
|
source "${OS_ROOT}/hack/lib/log.sh"
|
|
|
16
|
+source "${OS_ROOT}/hack/cmd_util.sh"
|
|
16
|
17
|
os::log::install_errexit
|
|
17
|
18
|
|
|
18
|
19
|
source "${OS_ROOT}/hack/lib/util/environment.sh"
|
|
...
|
...
|
@@ -98,51 +99,43 @@ oc login ${MASTER_ADDR} -u pull-secrets-user -p password --certificate-authority
|
|
98
|
98
|
|
|
99
|
99
|
# create a new project and push a busybox image in there
|
|
100
|
100
|
oc new-project image-ns
|
|
101
|
|
-oc delete all --all
|
|
102
|
|
-IMAGE_NS_TOKEN=`oc get sa/builder --template='{{range .secrets}}{{ .name }} {{end}}' | xargs -n 1 oc get secret --template='{{ if .data.token }}{{ .data.token }}{{end}}' | base64 -d -`
|
|
103
|
|
-docker login -u imagensbuilder -p ${IMAGE_NS_TOKEN} -e fake@example.org ${DOCKER_REGISTRY}
|
|
104
|
|
-oc tag --source=docker busybox:latest image-ns/busybox:latest
|
|
105
|
|
-oc import-image busybox
|
|
106
|
|
-docker pull busybox
|
|
107
|
|
-docker tag -f docker.io/busybox:latest ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
108
|
|
-docker push ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
109
|
|
-docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
|
101
|
+os::cmd::expect_success "oc delete all --all"
|
|
|
102
|
+IMAGE_NS_TOKEN=$(oc sa get-token builder)
|
|
|
103
|
+os::cmd::expect_success "docker login -u imagensbuilder -p ${IMAGE_NS_TOKEN} -e fake@example.org ${DOCKER_REGISTRY}"
|
|
|
104
|
+os::cmd::expect_success "oc import-image busybox:latest --confirm"
|
|
|
105
|
+os::cmd::expect_success "docker pull busybox"
|
|
|
106
|
+os::cmd::expect_success "docker tag -f docker.io/busybox:latest ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|
|
|
107
|
+os::cmd::expect_success "docker push ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|
|
|
108
|
+os::cmd::expect_success "docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|
|
110
|
109
|
|
|
111
|
110
|
|
|
112
|
111
|
DOCKER_CONFIG_JSON=${HOME}/.docker/config.json
|
|
113
|
112
|
oc new-project dc-ns
|
|
114
|
|
-oc delete all --all
|
|
115
|
|
-oc delete secrets --all
|
|
116
|
|
-oc secrets new image-ns-pull .dockerconfigjson=${DOCKER_CONFIG_JSON}
|
|
117
|
|
-oc secrets new-dockercfg image-ns-pull-old --docker-email=fake@example.org --docker-username=imagensbuilder --docker-server=${DOCKER_REGISTRY} --docker-password=${IMAGE_NS_TOKEN}
|
|
118
|
|
-
|
|
119
|
|
-oc process -f test/extended/fixtures/image-pull-secrets/pod-with-no-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f -
|
|
120
|
|
-wait_for_command "oc describe pod/no-pull-pod | grep 'Back-off pulling image'" 30*TIME_SEC
|
|
121
|
|
-oc delete pods --all
|
|
122
|
|
-
|
|
123
|
|
-# TODO remove sleeps once jsonpath stops panicing. The code still works without the sleep, it just looks nasty
|
|
124
|
|
-
|
|
125
|
|
-oc process -f test/extended/fixtures/image-pull-secrets/pod-with-new-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f -
|
|
126
|
|
-sleep 1
|
|
127
|
|
-wait_for_command "oc get pods/new-pull-pod -o jsonpath='{.status.containerStatuses[0].imageID}' | grep 'docker'" 30*TIME_SEC
|
|
128
|
|
-oc delete pods --all
|
|
129
|
|
-docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
130
|
|
-
|
|
131
|
|
-
|
|
132
|
|
-oc process -f test/extended/fixtures/image-pull-secrets/pod-with-old-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f -
|
|
133
|
|
-sleep 1
|
|
134
|
|
-wait_for_command "oc get pods/old-pull-pod -o jsonpath={.status.containerStatuses[0].imageID} | grep 'docker'" 30*TIME_SEC
|
|
135
|
|
-oc delete pods --all
|
|
136
|
|
-docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
137
|
|
-
|
|
138
|
|
-oc process -f test/extended/fixtures/image-pull-secrets/dc-with-old-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f -
|
|
139
|
|
-sleep 4
|
|
140
|
|
-wait_for_command "oc get pods/my-dc-old-1-prehook -o jsonpath={.status.containerStatuses[0].imageID} | grep 'docker'" 30*TIME_SEC
|
|
141
|
|
-oc delete all --all
|
|
142
|
|
-docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
143
|
|
-
|
|
144
|
|
-oc process -f test/extended/fixtures/image-pull-secrets/dc-with-new-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f -
|
|
145
|
|
-sleep 4
|
|
146
|
|
-wait_for_command "oc get pods/my-dc-1-prehook -o jsonpath={.status.containerStatuses[0].imageID} | grep 'docker'" 30*TIME_SEC
|
|
147
|
|
-oc delete all --all
|
|
148
|
|
-docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest
|
|
|
113
|
+os::cmd::expect_success "oc delete all --all"
|
|
|
114
|
+os::cmd::expect_success "oc delete secrets --all"
|
|
|
115
|
+os::cmd::expect_success "oc secrets new image-ns-pull .dockerconfigjson=${DOCKER_CONFIG_JSON}"
|
|
|
116
|
+os::cmd::expect_success "oc secrets new-dockercfg image-ns-pull-old --docker-email=fake@example.org --docker-username=imagensbuilder --docker-server=${DOCKER_REGISTRY} --docker-password=${IMAGE_NS_TOKEN}"
|
|
|
117
|
+
|
|
|
118
|
+os::cmd::expect_success "oc process -f test/extended/fixtures/image-pull-secrets/pod-with-no-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f - "
|
|
|
119
|
+os::cmd::try_until_text "oc describe pod/no-pull-pod" 'Back-off pulling image'
|
|
|
120
|
+os::cmd::expect_success "oc delete pods --all"
|
|
|
121
|
+
|
|
|
122
|
+os::cmd::expect_success "oc process -f test/extended/fixtures/image-pull-secrets/pod-with-new-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f - "
|
|
|
123
|
+os::cmd::try_until_text 'oc get pods/new-pull-pod -o jsonpath={.status.containerStatuses[0].imageID}' 'docker'
|
|
|
124
|
+os::cmd::expect_success "oc delete pods --all"
|
|
|
125
|
+os::cmd::expect_success "docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|
|
|
126
|
+
|
|
|
127
|
+os::cmd::expect_success "oc process -f test/extended/fixtures/image-pull-secrets/pod-with-old-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f - "
|
|
|
128
|
+os::cmd::try_until_text 'oc get pods/old-pull-pod -o jsonpath={.status.containerStatuses[0].imageID}' 'docker'
|
|
|
129
|
+os::cmd::expect_success "oc delete pods --all"
|
|
|
130
|
+os::cmd::expect_success "docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|
|
|
131
|
+
|
|
|
132
|
+os::cmd::expect_success "oc process -f test/extended/fixtures/image-pull-secrets/dc-with-old-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f - "
|
|
|
133
|
+os::cmd::try_until_text 'oc get pods/my-dc-old-1-hook-pre -o jsonpath={.status.containerStatuses[0].imageID}' 'docker'
|
|
|
134
|
+os::cmd::expect_success "oc delete all --all"
|
|
|
135
|
+os::cmd::expect_success "docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|
|
|
136
|
+
|
|
|
137
|
+os::cmd::expect_success "oc process -f test/extended/fixtures/image-pull-secrets/dc-with-new-pull-secret.yaml --value=DOCKER_REGISTRY=${DOCKER_REGISTRY} | oc create -f - "
|
|
|
138
|
+os::cmd::try_until_text 'oc get pods/my-dc-1-hook-pre -o jsonpath={.status.containerStatuses[0].imageID}' 'docker'
|
|
|
139
|
+os::cmd::expect_success "oc delete all --all"
|
|
|
140
|
+os::cmd::expect_success "docker rmi -f ${DOCKER_REGISTRY}/image-ns/busybox:latest"
|