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

--commit-range ignored, needs documentation update #48

Closed
consideRatio opened this issue Oct 13, 2019 · 4 comments · Fixed by #55
Closed

--commit-range ignored, needs documentation update #48

consideRatio opened this issue Oct 13, 2019 · 4 comments · Fixed by #55

Comments

@consideRatio
Copy link
Member

Since 55fe935, the --commit-range argument is no longer needed for chartpress to do a good job.

We should update the documentation to reflect this.

@yuvipanda
Copy link
Contributor

Don't you still need commit range if the docker image gets pushed to an authenticated registry on deploy, but you want to use chartpress to build the image in PR without giving it the credentials to access the registry?

@consideRatio
Copy link
Member Author

Hmm... yes. The chartpress logic currently is that a check is run if it is locally available, and if it isn't, it checks in the external docker repository. But, if you at this point don't have access to the repository for the check because you didn't want to provide such credentials, you should fall back to rebuilding it right?

This may already be what's happening, if the docker.errors.APIError is raised at least.

chartpress/chartpress.py

Lines 141 to 160 in 9ded86b

def image_needs_pushing(image):
"""Return whether an image needs pushing
Args:
image (str): the `repository:tag` image to be build.
Returns:
True: if image needs to be pushed (not on registry)
False: if not (already present on registry)
"""
d = docker_client()
try:
d.images.get_registry_data(image)
except docker.errors.APIError:
# image not found on registry, needs pushing
return True
else:
return False

consideRatio added a commit to consideRatio/zero-to-jupyterhub-k8s that referenced this issue Oct 13, 2019
@yuvipanda
Copy link
Contributor

As an example, see https://github.com/berkeley-dsep-infra/datahub/blob/235ba9f7af14e16f8b25d85799b75737c199da4b/.circleci/config.yml#L46

This never hits the docker API at all if the images haven't changed in commit-range. If we rebuilt it all the time it will slow down PRs considerably.

@consideRatio
Copy link
Member Author

consideRatio commented Oct 15, 2019

@yuvipanda yes I agree and care about this optimization a lot, but since the already merged commit mentioned, or chartpress 0.3.1 i believe, --commit-range is not consumed even though it is passed.

The commit-range args are parsed, and then passed to the build images function, but then never used since the commit referenced in the original post. Instead logic to see if the image is locally or externally avaialable is used to determine the need for the image to rebuild.

And yes, if the external image registry is private and the docker client used isnt having the proper credentials, it wount be able to conclude if it is externally available. Above I reasoned that it would not be able to fetch it for use either.

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

Successfully merging a pull request may close this issue.

2 participants