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] Build PR images on GHCR #3445

Merged
merged 9 commits into from
Nov 21, 2023
Merged

[CI] Build PR images on GHCR #3445

merged 9 commits into from
Nov 21, 2023

Conversation

jlestel
Copy link
Contributor

@jlestel jlestel commented Nov 17, 2023

I modified the CI so that the PR images are build then pushed into the GitHub packages (GHCR).

This does not interfere with how current CI works with Docker Hub.

Functioning :

  • When a PR is created or modified: the image is built on the GHCR from fork repo.
  • When a branch is pushed: the image is built on the GHCR from main repo.
  • When a PR is completed: the image is deleted in the fork repo. Additionally, untagged images are also deleted on this fork repo.

Once this PR is merged, each new / updated PR will trigger CI on the fork repo.

If necessary, anyone can then modify their docker-compose to use a PR image (eg: ghcr.io/jlestel/teslamate:master) for testing this PR instead of teslamate/teslamate:latest.

After the first run, packages are created in the user repo but images can't be pushed to this user repo.

Each user which want to build his images needs to :

  1. Activate Actions in their repo
  2. In the packages user page (eg: https://github.com/users/jlestel/packages/`), go to teslamate and teslamate/grafana settings and add the user/teslamate repository with read/write permissions.

@jlestel jlestel marked this pull request as draft November 17, 2023 11:45
@jlestel jlestel marked this pull request as ready for review November 17, 2023 12:33
@JakobLichterfeld JakobLichterfeld self-requested a review November 19, 2023 09:05
@JakobLichterfeld JakobLichterfeld added the github_actions Pull requests that update Github_actions code label Nov 19, 2023
Copy link
Collaborator

@JakobLichterfeld JakobLichterfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks again for the refactoring and the new workflow!

@JakobLichterfeld JakobLichterfeld merged commit eadf082 into teslamate-org:master Nov 21, 2023
@DrMichael
Copy link
Collaborator

This is awesome!
Perhaps we should have a section for contributors in the documentation?

@JakobLichterfeld
Copy link
Collaborator

Perhaps we should have a section for contributors in the documentation?

Yeah, I thought the same thing, one step at a time.

JakobLichterfeld pushed a commit that referenced this pull request Feb 9, 2024
* Upgrade CI

* Tmp Test

* Test tmp

* Test master

* Distinct cache by branch

* Correct version name

* Dynamic dockerhub push

* correct cache name

---------

Co-authored-by: Julien <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update Github_actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants