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

Artifact package releases #657

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
cp docs/mkdocs.yml ./
- name: Render
run: uv run mkdocs build
- uses: actions/upload-artifact@v4
with:
name: Docs
path: site

build-linux-lint:
runs-on: ubuntu-24.04
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ jobs:
- uses: actions/checkout@v2
- name: Setup uv
run: ./scripts/install-uv.sh
- name: Build and publish
env:
UV_PUBLISH_USERNAME: ${{ secrets.PYPI_USERNAME }}
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: Build
run: |
uv build
uv publish
- name: Add release assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./dist/*.whl
asset_name: python-on-whales.whl
asset_content_type: application/zip
- name: Testing the uploaded wheel
run: |
uv run --with python-on-whales --no-project -- python -c "import python_on_whales"
4 changes: 4 additions & 0 deletions python_on_whales/components/buildx/cli_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def bake(
set: Dict[str, str] = {},
variables: Dict[str, str] = {},
stream_logs: bool = False,
context: Union[str, None] = None,
) -> Union[Dict[str, Dict[str, Dict[str, Any]]], Iterator[str]]:
"""Bake is similar to make, it allows you to build things declared in a file.

Expand All @@ -148,6 +149,7 @@ def bake(
set: A list of overrides in the form `"targetpattern.key=value"`.
variables: A dict containing the values of the variables defined in the
hcl file. See <https://github.com/docker/buildx#hcl-variables-and-functions>
context: Context (optionally remote) in which to find definition files

# Returns
The configuration used for the bake (files merged + override with
Expand Down Expand Up @@ -197,6 +199,8 @@ def bake(
for file in to_list(files):
full_cmd.add_simple_arg("--file", file)
full_cmd.add_args_iterable_or_single("--set", format_mapping_for_cli(set))
if context is not None:
full_cmd.append(context)
targets = to_list(targets)
env = dict(variables)
if print:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,33 @@ def test_bake_with_variables_2(only_print, monkeypatch):
}


@pytest.mark.usefixtures("with_docker_driver")
@pytest.mark.usefixtures("change_cwd")
@pytest.mark.parametrize("only_print", [True, False])
def test_bake_with_remote_context(only_print):
config = docker.buildx.bake(
print=only_print,
context="https://github.com/gabrieldemarmiesse/python-on-whales.git#v0.74.0:tests/python_on_whales/components/bake_tests",
)
assert config == {
"group": {"default": {"targets": ["my_out1", "my_out2"]}},
"target": {
"my_out1": {
"context": "https://github.com/gabrieldemarmiesse/python-on-whales.git#v0.74.0:tests/python_on_whales/components/bake_tests",
"dockerfile": "Dockerfile",
"tags": ["pretty_image1:1.0.0"],
"target": "out1",
},
"my_out2": {
"context": "https://github.com/gabrieldemarmiesse/python-on-whales.git#v0.74.0:tests/python_on_whales/components/bake_tests",
"dockerfile": "Dockerfile",
"tags": ["pretty_image2:1.0.0"],
"target": "out2",
},
},
}


@pytest.mark.usefixtures("with_docker_driver")
@pytest.mark.usefixtures("change_cwd")
def test_bake_stream_logs(monkeypatch):
Expand Down