Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Provide built image so that users don't have to build it for every commit #36

Closed
lpenz opened this issue Jul 12, 2020 · 13 comments
Closed
Labels
enhancement New feature or request

Comments

@lpenz
Copy link
Contributor

lpenz commented Jul 12, 2020

No description provided.

@lpenz
Copy link
Contributor Author

lpenz commented Jul 12, 2020

Github actions can use a URL with docker:// prefix to download built images from hub.docker.com.
Doing that would make actions run faster by bypassing building the image during the action.

@j0holo
Copy link

j0holo commented Aug 26, 2020

Great idea, does the Ansible team/maintainers want to host their own image on Docker hub or can we use an already existing one by a third party?

@lpenz
Copy link
Contributor Author

lpenz commented Aug 30, 2020

I think the Dockerfile already present in this repository works fine.

@j0holo
Copy link

j0holo commented Aug 31, 2020

I get that, but the build image needs to be stored somewhere right? We could use the GitHub registry which is free but not usable for commonly used Action. Docker hub is an obvious choice, but then who will host it?

@adamrushuk
Copy link

@lpenz I'm interested in hearing more on this.

Looking through the documentation, do you mean change this line: https://github.com/ansible/ansible-lint-action/blob/master/action.yml#L45

to image: 'docker://<DOCKER_IMAGE>:<TAG>'

as per this example? https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/metadata-syntax-for-github-actions#example-using-public-docker-registry-container

@lpenz
Copy link
Contributor Author

lpenz commented Nov 7, 2020

That line is fine

What we need to change is the retrieval of the arguments - they have to be obtained from environment variables. I did that in here:
lpenz@fd26cb9
(I can make a pull request if people want)

After that, whoever owns the "ansible" user in hub.docker.com should set it up to build the image from this repository, "latest" from master and tag versions seems appropriate.

You can then use the image by specifying - uses: docker://ansible/ansible-lint-action:VERSION in a github workflow. The workflow will just download the image from hub.docker.com instead of building it every time.

@adamrushuk
Copy link

That would be great if the repo owners could implement similar so we wouldn't have to build every time. 👍🏼

@danielkubat
Copy link

You can then use the image by specifying - uses: docker://ansible/ansible-lint-action:VERSION in a github workflow. The workflow will just download the image from hub.docker.com instead of building it every time.

I second that, especially when Ansible has already user on Docker hub with an images. (https://hub.docker.com/u/ansible). Based on my experience, building of Docker image every time consumes about 80-90% of entire GH Action runtime.

@cognifloyd
Copy link

According to actions/runner-images#1445 (comment)

For publicly accessible containers we are working with docker hub to make sure you will not be impacted by the new rate limits. If you need private containers we still do not have a solution for that problem for forks of public repos.

So, relying on docker hub should not hit rate limiting in github actions (at least for public repos). :)

@cognifloyd
Copy link

I asked on #ansible-devel about who can get this onto dockerhub and I got two responses:

***sivel wonders why ansible-lint hasn't been moved out of the ansible org yet...
sivel: Should have been done a while ago

zbr: molecule container includes ansible-lint, https://github.com/ansible-community/molecule-dist
cognifloyd: Is that on dockerhub?
tadeboro: My guess would be quay.io since most of the semi-official ansible stuff ends up there.
cognifloyd: this image? https://quay.io/repository/ansible/molecule
zbr: yes, but i stopped refreshing it two weeks ago, we will restore the build pipelines.

The ansible/molecule container is currently 318.3MB
Another possible container, yokogawa/ansible-lint, is 94.98MB.
This uses python:3.8-slim (45MB) and the yokogawa one uses python:3-alpine (17.31MB), so the container could be optimized by using or following the example of the yokogawa container.

@bluikko
Copy link

bluikko commented Dec 13, 2020

@lpenz I would find a PR very helpful, it is very annoying that the action takes 3 minutes in building step...

@lpenz
Copy link
Contributor Author

lpenz commented Jan 16, 2021

I've created a PR, here: #44

It's usable with docker://lpenz/ansible-lint-action:dockeraction, example: https://github.com/lpenz/ansible-playbooks/blob/ladatest/.github/workflows/main.yml

Result from that example: https://github.com/lpenz/ansible-playbooks/actions/runs/490558134

@ssbarnea
Copy link
Member

No longer valid for version on main branch, where we use creator-ee container and no longer build our own.

@ssbarnea ssbarnea added the enhancement New feature or request label Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants