-
Notifications
You must be signed in to change notification settings - Fork 2
feat: Attempt to support dockerhub private images #1019
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
Draft
eikek
wants to merge
5
commits into
main
Choose a base branch
from
eikek/feat/dockerhub-private-images
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| """Helper functions for writing migrations.""" | ||
|
|
||
| from alembic import op | ||
| from psycopg import sql | ||
|
|
||
|
|
||
| def get_enum_values(enum_type: str) -> list[str]: | ||
| """Return all values for the given enum type.""" | ||
| connection = op.get_bind() | ||
| ident = sql.Identifier(enum_type) | ||
| statement = ( | ||
| sql.SQL("select unnest(enum_range(null::{}))").format(ident).as_string(connection) # type: ignore[arg-type] | ||
| ) | ||
| result = connection.exec_driver_sql(statement) | ||
| rows = result.all() | ||
| return [v[0] for v in rows] | ||
|
|
||
|
|
||
| def create_enum_type(enum_type: str, values: list[str]) -> None: | ||
| """Creates a new enum type.""" | ||
| value_list = ", ".join([f"'{e}'" for e in values]) | ||
| op.execute(f"CREATE TYPE {enum_type} AS ENUM ({value_list})") |
36 changes: 36 additions & 0 deletions
36
...nents/renku_data_services/migrations/versions/c7d32e8b52cf_add_dockerhub_provider_kind.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| """add dockerhub provider kind | ||
|
|
||
| Revision ID: c7d32e8b52cf | ||
| Revises: 8365db35dc76 | ||
| Create Date: 2025-09-25 14:05:55.447619 | ||
|
|
||
| """ | ||
|
|
||
| from alembic import op | ||
|
|
||
| import renku_data_services.migrations.helper as helper | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "c7d32e8b52cf" | ||
| down_revision = "8365db35dc76" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| op.execute("ALTER TYPE providerkind ADD VALUE 'dockerhub'") | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| op.execute("DELETE FROM connected_services.oauth2_clients WHERE kind = 'dockerhub'") | ||
|
|
||
| current_values = helper.get_enum_values("providerkind") | ||
| current_values.remove("dockerhub") | ||
|
|
||
| op.execute("ALTER TYPE providerkind RENAME TO providerkind_old;") | ||
| helper.create_enum_type("providerkind", current_values) | ||
| op.execute( | ||
| "ALTER TABLE connected_services.oauth2_clients ALTER COLUMN kind SET DATA TYPE providerkind USING kind::text::providerkind" | ||
| ) | ||
|
|
||
| op.execute("DROP TYPE providerkind_old CASCADE") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a general remark: I think this API endpoint should be relocated somewhere else. It should not have
oauth2in the path when this is to handle third-party platforms which DO NOT implement OAuth 2.0.Some suggestions:
/integrations/...,/non-oauth2/...,/providers/..., etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, good point!