Skip to content

Add useful info to "pushing a container"#22007

Merged
vgrl merged 4 commits into
github:mainfrom
flopana:patch-1
Apr 24, 2023
Merged

Add useful info to "pushing a container"#22007
vgrl merged 4 commits into
github:mainfrom
flopana:patch-1

Conversation

@flopana
Copy link
Copy Markdown
Contributor

@flopana flopana commented Nov 14, 2022

When you push a container to ghcr.io without having the label org.opencontainers.image.source set GitHub won't connect the image to a repository. This results in the GITHUB_TOKEN not having the appropriate permissions.

Example:

Repository url: flopana/awesomeRepo
I push an image that is tagged with ghcr.io/flopana/awesomeRepo:latest to ghcr.io, GitHub won't link these two together.

If I now use the secrets.GITHUB_TOKEN in GitHub Actions on the repository flopana/awesomeRepo and try to push a container with it it fails with 403 Forbidden. Because the token belonging to this repository doesn't have the permission to write to a package that is not belonging to this repository.

If there is no package under that namespace and you push an image from the pipeline with the github token to ghcr.io, Github will link these two even without the label set.

But by advising the user to set the label in the Dockerfile github will link both together regardless of the order of pushing images.

My changes in the Documentation should prevent users from running into this problem like I did.

Feel free to make changes to my grammar/wording since English isn't my mother tongue.

Why:

Should be prevent users from running into permission errors like I did

What's being changed (if available, include any code snippets, screenshots, or gifs):

Stated above, I didn't see this template while writing the text above

Check off the following:

  • I have reviewed my changes in staging (look for the "Automatically generated comment" and click the links in the "Preview" column to view your latest changes).
  • For content changes, I have completed the self-review checklist.

When you push a container to ghcr.io without having the label `org.opencontainers.image.source` set GitHub won't connect the image to a repository. This results in the `GITHUB_TOKEN` not having the appropriate permissions.

Example:

Repository url: `flopana/awesomeRepo`
I push an image that is tagged with `ghcr.io/flopana/awesomeRepo:latest` to ghcr.io, GitHub won't link these two together.

If I now use the `secrets.GITHUB_TOKEN` in GitHub Actions on the repository `flopana/awesomeRepo` and try to push a container with it it fails with `403 Forbidden`. Because the token belonging to this repository doesn't have the permission to write to a package that is not belonging to this repository.

If there is no package under that namespace and you push an image from the pipeline with the github token to ghcr.io, Github will link these two even without the label set.

But by advising the user to set the label in the Dockerfile github will link both together regardless of the order of pushing images.

My changes in the Documentation should prevent users from running into this problem like I did.

Feel free to make changes to my grammar/wording since English isn't my mother tongue.
@welcome
Copy link
Copy Markdown

welcome Bot commented Nov 14, 2022

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions Bot added the triage Do not begin working on this issue until triaged by the team label Nov 14, 2022
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 14, 2022

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Preview Production What Changed
packages/working-with-a-github-packages-registry/working-with-the-container-registry.md fpt
ghec
ghes@ 3.8 3.7 3.6 3.5
fpt
ghec
ghes@ 3.8 3.7 3.6 3.5

fpt: Free, Pro, Team
ghec: GitHub Enterprise Cloud
ghes: GitHub Enterprise Server
ghae: GitHub AE

Kidi666

This comment was marked as spam.

@flopana
Copy link
Copy Markdown
Contributor Author

flopana commented Nov 15, 2022

Narrow AI

what?

@cmwilson21
Copy link
Copy Markdown
Contributor

@flopana Thanks so much for opening a PR! I'll get this triaged for review ⚡

@cmwilson21 cmwilson21 added content This issue or pull request belongs to the Docs Content team actions This issue or pull request should be reviewed by the docs actions team waiting for review Issue/PR is waiting for a writer's review and removed triage Do not begin working on this issue until triaged by the team labels Nov 15, 2022
@vgrl vgrl added the needs SME This proposal needs review from a subject matter expert label Nov 24, 2022
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for opening a pull request! We've triaged this issue for technical review by a subject matter expert 👀

@Jazzcys3004

This comment was marked as spam.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 7, 2023

This is a gentle bump for the docs team that this PR is waiting for technical review.

@github-actions github-actions Bot added the SME stale The request for an SME has staled label Jan 7, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Jan 9, 2023
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2023

This is a gentle bump for the docs team that this PR is waiting for technical review.

@github-actions github-actions Bot added the SME stale The request for an SME has staled label Feb 7, 2023
@cmwilson21 cmwilson21 added packages This issue or pull request should be reviewed by the docs packages team and removed SME stale The request for an SME has staled actions This issue or pull request should be reviewed by the docs actions team labels Feb 7, 2023
@github-actions
Copy link
Copy Markdown
Contributor

This is a gentle bump for the docs team that this PR is waiting for technical review.

@github-actions github-actions Bot added the SME stale The request for an SME has staled label Mar 10, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Mar 13, 2023
@github-actions
Copy link
Copy Markdown
Contributor

This is a gentle bump for the docs team that this PR is waiting for technical review.

@github-actions github-actions Bot added the SME stale The request for an SME has staled label Apr 11, 2023
@vgrl
Copy link
Copy Markdown
Contributor

vgrl commented Apr 23, 2023

👋 @flopana thanks for your PR and I apologize that it took this long for us to get back on this 💖 .

I've spoken with the engineering team and consequently we'd like to add a bit more detail to doc in relation to the issue you're addressing. I'll push a few changes, check on preview, and then merge if all looks good! ⚡

Copy link
Copy Markdown
Contributor

@vgrl vgrl left a comment

Choose a reason for hiding this comment

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

Looks good on preview 🎉

@vgrl vgrl added this pull request to the merge queue Apr 24, 2023
Merged via the queue into github:main with commit a210294 Apr 24, 2023
@github-actions
Copy link
Copy Markdown
Contributor

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues

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

Labels

content This issue or pull request belongs to the Docs Content team needs SME This proposal needs review from a subject matter expert packages This issue or pull request should be reviewed by the docs packages team SME stale The request for an SME has staled waiting for review Issue/PR is waiting for a writer's review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants