CircleCI-Public / redhat-openshift-orb

A CircleCI Orb to simplify deployments to Red Hat OpenShift.
http://circleci.com/orbs/registry/orb/circleci/redhat-openshift
MIT License
1 stars 5 forks source link

build error: failed to push image #5

Closed wenzowski closed 5 years ago

wenzowski commented 5 years ago

When trying to push a build to an imagestream the push fails.

Successfully built c7916e639d18
Successfully tagged temp.builder.openshift.io/wksv3k-tools/cas-postgres-1:50520a70

Pushing image 172.30.1.1:5000/wksv3k-tools/cas-postgres:c029493df529962fcd7c40996250c98fa702818f ...
Registry server Address: 
Registry server User Name: serviceaccount
Registry server Email: serviceaccount@example.org
Registry server Password: <<non-empty>>
error: build error: Failed to push image: Get https://172.30.1.1:5000/v2/: http: server gave HTTP response to HTTPS client
iynere commented 5 years ago

@wenzowski can you drop a link to the CircleCI job where you're seeing this error?

it looks like we expect an https address for the push destination, but you're trying to push to one that only uses http ?

wenzowski commented 5 years ago

Of course! Attempt to push at the end of the cas-postgres#37 build. Thanks!

iynere commented 5 years ago

@wenzowski as the command that failed isn't actually part of the orb, it's not 100% clear to me that the issue lies in the orb source code... is there something that led you to believe this to be the case ?

iynere commented 5 years ago

@lokst you're more familiar with this orb than i am—do you have any thoughts here ?

wenzowski commented 5 years ago

@iynere I'm working on an isolated test

Ideally, any s2i build that completes successfully should be able to push to the openshift 3.11 registry created via create-local-cluster-with-oc.yml in order to test config files before attempting to deploy to a test cluster.

lokst commented 5 years ago

@wenzowski Could you share the commands you are using to build and push the docker image to the registry?

iynere commented 5 years ago

@lokst we should add integration tests where an image is pushed to an openshift registry created by the orb, yes ?

lokst commented 5 years ago

@iynere Yes, I'm looking into testing that

wenzowski commented 5 years ago

@lokst @iynere I extended a test that was already there but haven't found a fix yet

lokst commented 5 years ago

@wenzowski I was able to reproduce the same error but haven't been able to find a fix for this yet too, I'm gonna continue trying

wenzowski commented 5 years ago

@lokst I'm reasonably confident we need to mark the registry as insecure but I can't figure out how to use a << anymore since that's now reserved for template interpolation :'(

cat << EOF >/home/circleci/.docker/config.json
{
 "insecure-registries": [
 "172.30.0.0/16"
 ]
}
EOF
wenzowski commented 5 years ago

probably related to openshift/origin#8997

iynere commented 5 years ago

@wenzowski i can answer that question for you quickly—you just need to escape it:

/<<

see example:

https://github.com/CircleCI-Public/cimg-orb/blob/master/src/commands/test.yml#L97

lokst commented 5 years ago

@wenzowski Were you able to resolve the issue after configuring Docker?

Without configuring Docker, I was able to get pushing of an image to the local registry to work using docker push and making sure that port 80 is used as the docker registry URL. This StackOverflow article was a good reference for me: https://stackoverflow.com/questions/45624945/unable-to-push-a-docker-image-to-local-openshift-origin-registry

oc login -u system:admin
oc expose svc/docker-registry -n default --as system:admin
oc login -u devuser -p password
sleep 60
docker login -u devuser -p `oc whoami -t` http://docker-registry-default.127.0.0.1.nip.io:80/
docker pull alpine
oc new-project localclustertestproject
docker tag alpine:latest docker-registry-default.127.0.0.1.nip.io:80/localclustertestproject/alpine
docker push docker-registry-default.127.0.0.1.nip.io:80/localclustertestproject/alpine
wenzowski commented 5 years ago

@lokst that'll do it :)

wenzowski commented 5 years ago

I'd initially gotten it wrong by trying to use the /home/circleci/.docker/config.json and not the /etc/docker/daemon.json.

Fixing that and restarting the daemon solved everything, in keeping with the 3.11 docs

lokst commented 5 years ago

Thanks for sharing @wenzowski !