Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Fix docker pull from internal registry #17683

Closed
kuisathaverat opened this issue Apr 13, 2020 · 6 comments
Closed

[CI] Fix docker pull from internal registry #17683

kuisathaverat opened this issue Apr 13, 2020 · 6 comments

Comments

@kuisathaverat
Copy link
Contributor

kuisathaverat commented Apr 13, 2020

if we make a docker pull we can pull the image but the command cd x-pack/metricbeat; mage update build test cannot pull the image. We have to find why and fix it.
When we fix the issue we can remove the workaround from the Jenkinsfile.

related to #17620

@kuisathaverat
Copy link
Contributor Author

kuisathaverat commented Apr 13, 2020

I think github.com/elastic/beats/v7/libbeat/tests/compose ignores the Docker credentials.

@kuisathaverat
Copy link
Contributor Author

I think https://golang.org/pkg/os/exec ignores de environment variables defined on the parent environment, because of that HOME is incorrect and the Docker credentials are not defined.

@andrewkroh
Copy link
Member

andrewkroh commented Apr 17, 2020

I had to do a little hunting to understand why the docker login was required. IIUC the integration tests for Metricbeat that run when TEST_TAGS=oracle require a non-public image.

The integrations tests that are using github.com/elastic/beats/v7/libbeat/tests/compose are being run inside of this container:

beat:
build: ../../metricbeat
environment:
- BEAT_STRICT_PERMS=false
- TEST_ENVIRONMENT=false
working_dir: /go/src/github.com/elastic/beats/x-pack/metricbeat
volumes:
- ${PWD}/../..:/go/src/github.com/elastic/beats/
- /var/run/docker.sock:/var/run/docker.sock
network_mode: host
command: make

docker login persists state to $HOME/.docker/config.json. So if Metricbeat needs those credentials then you could add it like:

$ git diff .
diff --git a/x-pack/metricbeat/docker-compose.yml b/x-pack/metricbeat/docker-compose.yml
index c89b55860..83ac016ff 100644
--- a/x-pack/metricbeat/docker-compose.yml
+++ b/x-pack/metricbeat/docker-compose.yml
@@ -10,6 +10,7 @@ services:
     volumes:
       - ${PWD}/../..:/go/src/github.com/elastic/beats/
       - /var/run/docker.sock:/var/run/docker.sock
+      - ${HOME}/.docker:/root/.docker:ro
     network_mode: host
     command: make

And since it's only x-pack/metricbeat's integration tests requiring this maybe it's best to only do the dockerLogin from that particular stage?

@kuisathaverat
Copy link
Contributor Author

Couchbase needs to login too and more will come sure.

@kuisathaverat
Copy link
Contributor Author

I have to tested it but this add the credentials to the metricbeat Docker container, Do the metricbeat Docker container build the Oracle image for the tests?

@andrewkroh
Copy link
Member

Yes, I believe docker-compose starts this service on demand when the test asks for it. And the test is running inside of a container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants