Skip to content

Commit

Permalink
Merge pull request #77 from containers/podlet-v0.3.0
Browse files Browse the repository at this point in the history
Podlet v0.3.0
  • Loading branch information
k9withabone authored May 17, 2024
2 parents ffdbb03 + 2ecb6b2 commit 79d6aa0
Show file tree
Hide file tree
Showing 10 changed files with 609 additions and 580 deletions.
77 changes: 44 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Copyright 2022-2023, axodotdev
# Copyright 2022-2024, axodotdev
# SPDX-License-Identifier: MIT or Apache-2.0
#
# CI that:
#
# * checks for a Git Tag that looks like a release
# * builds artifacts with cargo-dist (archives, installers, hashes)
# * uploads those artifacts to temporary workflow zip
# * on success, uploads the artifacts to a Github Release
# * on success, uploads the artifacts to a GitHub Release
#
# Note that the Github Release will be created with a generated
# Note that the GitHub Release will be created with a generated
# title/body based on your changelogs.

name: Release
Expand All @@ -31,7 +31,7 @@ permissions:
# packages versioned/released in lockstep).
#
# If you push multiple tags at once, separate instances of this workflow will
# spin up, creating an independent announcement for each one. However Github
# spin up, creating an independent announcement for each one. However, GitHub
# will hard limit this to 3 tags per commit, as it will assume more tags is a
# mistake.
#
Expand Down Expand Up @@ -62,23 +62,23 @@ jobs:
# we specify bash to get pipefail; it guards against the `curl` command
# failing. otherwise `sh` won't catch that `curl` returned non-0
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.8.1/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
# sure would be cool if github gave us proper conditionals...
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
# functionality based on whether this is a pull_request, and whether it's from a fork.
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
# but also really annoying to build CI around when it needs secrets to work right.)
- id: plan
run: |
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > dist-manifest.json
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
echo "cargo dist ran successfully"
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
cat plan-dist-manifest.json
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
path: dist-manifest.json
name: artifacts-plan-dist-manifest
path: plan-dist-manifest.json

# Build and packages all the platform-specific things
build-local-artifacts:
Expand All @@ -105,18 +105,24 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
steps:
- name: enable windows longpaths
run: |
git config --global core.longpaths true
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: swatinem/rust-cache@v2
with:
key: ${{ join(matrix.targets, '-') }}
- name: Install cargo-dist
run: ${{ matrix.install_dist }}
# Get the dist-manifest
- name: Fetch local artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- name: Install dependencies
run: |
${{ matrix.packages_install }}
Expand All @@ -134,14 +140,14 @@ jobs:
run: |
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
- name: "Upload artifacts"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
Expand All @@ -160,13 +166,15 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.8.1/cargo-dist-installer.sh | sh"
shell: bash
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
- name: Fetch local artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
merge-multiple: true
- id: cargo-dist
shell: bash
run: |
Expand All @@ -175,14 +183,14 @@ jobs:
# Parse out what we just built and upload it to scratch storage
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
jq --raw-output ".artifacts[]?.path | select( . != null )" dist-manifest.json >> "$GITHUB_OUTPUT"
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
- name: "Upload artifacts"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
name: artifacts-build-global
path: |
${{ steps.cargo-dist.outputs.paths }}
${{ env.BUILD_MANIFEST_NAME }}
Expand All @@ -204,14 +212,15 @@ jobs:
with:
submodules: recursive
- name: Install cargo-dist
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.8.1/cargo-dist-installer.sh | sh"
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.14.1/cargo-dist-installer.sh | sh"
# Fetch artifacts from scratch-storage
- name: Fetch artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: target/distrib/
# This is a harmless no-op for Github Releases, hosting for that happens in "announce"
merge-multiple: true
# This is a harmless no-op for GitHub Releases, hosting for that happens in "announce"
- id: host
shell: bash
run: |
Expand All @@ -220,12 +229,13 @@ jobs:
cat dist-manifest.json
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
- name: "Upload dist-manifest.json"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: artifacts
# Overwrite the previous copy
name: artifacts-dist-manifest
path: dist-manifest.json

# Create a Github Release while uploading all files to it
# Create a GitHub Release while uploading all files to it
announce:
needs:
- plan
Expand All @@ -241,16 +251,17 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: "Download Github Artifacts"
uses: actions/download-artifact@v3
- name: "Download GitHub Artifacts"
uses: actions/download-artifact@v4
with:
name: artifacts
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Cleanup
run: |
# Remove the granular manifests
rm -f artifacts/*-dist-manifest.json
- name: Create Github Release
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.plan.outputs.tag }}
Expand Down
111 changes: 111 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,107 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.0] - 2024-05-17

Big release for Podlet!

In case you didn't already notice, Podlet is now officially a part of the [Containers](https://github.com/containers/) community! As a part of the transition, a new code of conduct, security policy, and contribution guidelines were added ([#76](https://github.com/containers/podlet/pull/76)). Additionally, the Podlet container image is now available at ghcr.io/containers/podlet. The existing images at quay.io/k9withabone/podlet and docker.io/k9withabone/podlet are deprecated and will not be receiving updates.

Under the hood, the library used to deserialize Compose files was changed ([#73](https://github.com/containers/podlet/pull/73)). As a result, only Compose files which follow the [Compose specification](https://github.com/compose-spec/compose-spec) are supported. The top-level `version` field is completely ignored. Most Compose files should still work as before. This was a large change so look out for bugs.

Added support for Quadlet options introduced in Podman v5.0.0 ([#75](https://github.com/containers/podlet/pull/75)). The headline feature is support for generating Quadlet `.pod` files. They can be generated from:

- A Podman command with `podlet podman pod create`.
- A Compose file with `podlet compose --pod`.
- An existing pod with `podlet generate pod`.
- This creates a `.pod` file and a `.container` file for each container in the pod.

Note that the existing option for generating Kubernetes Pod YAML from a Compose file was renamed to `podlet compose --kube`. Both the `--pod` and `--kube` options of `podlet compose` do not take an argument and instead require the top-level `name` field in the Compose file. The `name` is used as the name of the pod and in the filename of the created files.

### Features
- Add `podlet --binds-to` option.
- **BREAKING** *(compose)* Rename `podlet compose --pod` to `podlet compose --kube`.
- *(container)* Add `Entrypoint=` Quadlet option.
- *(container)* Add `StopTimeout=` Quadlet option.
- *(container)* Support `Notify=healthy` Quadlet option.
- *(container)* Support `no-dereference` option for `Mount=`.
- *(container)* Add `podman run --preserve-fd` option.
- *(container)* Add `podman run --gpus` option.
- *(container)* Add `podman run --retry` option.
- *(container)* Add `podman run --retry-delay` option.
- Add `podman --config` global option.
- *(pod)* Generate `.pod` Quadlet file from command.
- Adds the `podlet podman pod create` subcommand.
- The `--infra-conmon-pidfile` and `--pod-id-file` options were deliberately not implemented as they are set by Quadlet in the generated `{name}-pod.service` file and can't be set multiple times.
- **BREAKING** *(compose)* Re-add `podlet compose --pod` option.
- The `--pod` option causes podlet to create a `.pod` Quadlet file in addition to the `.container`, `.volume`, and `.network` files. The containers are linked to the pod and their published ports are moved.
- *(generate)* Quadlet files from an existing pod and its containers.
- Adds the `podlet generate pod` subcommand.
- Runs `podman pod inspect` on the given pod.
- Deserializes the output.
- Parses the pod creation command.
- Does the same for each of the pod's containers.

### Bug Fixes
- Use Quadlet serializer for `Unit` `Display` implementation ([#64](https://github.com/containers/podlet/issues/64)).
- Brings `Unit` inline with the other sections of the generated Quadlet file.
- *(container)* Add `podman run --uts` option.
- *(container)* `--pids-limit` range is `-1..=u32::MAX`.
- *(container)* Enforce `--blkio-weight` range `10..=1000`.
- *(container)* `--blkio-weight-device` can be specified multiple times.
- *(container)* Don't add empty `PodmanArgs=` when downgrading Podman version.

### Documentation
- *(clippy)* Fix Clippy lint warning for `Idmap`.
- *(compose)* `--kube` help add `name` requirement.
- Add code of conduct.
- Add security policy.
- Update links to the repository.
- The repository is now at https://github.com/containers/podlet.
- *(contributing)* Add contribution guidelines.
- Adapted from the Buildah/Podman contribution guidelines.
- Suggests the use of conventional commits and clarifies that the `Signed-off-by` footer is required for a PR to be merged.
- Moved and expanded upon the building and continuous integration sections from the `README.md` file to the new `CONTRIBUTING.md` file.
- *(readme)* Update container image location.
- The Podlet container image is now located at ghcr.io/containers/podlet.
- Fix Podman and Quadlet capitalization.
- *(readme)* Update demo, features, and usage.

### Refactor
- **BREAKING** *(deps)* Remove `docker_compose_types`.
- **BREAKING** *(compose)* Deserialize `compose_spec::Compose`.
- `cli::Unit::is_empty()`
- Check each field instead of comparing to the default.
- *(compose)* Conversion to `quadlet::File`s from `compose_spec::Compose`.
- *(compose)* `quadlet::Globals` from `compose_spec::Service`.
- *(compose)* Container Quadlet options from `compose_spec::Service`.
- *(compose)* Container Podman args from `compose_spec::Service`.
- *(compose)* `quadlet::Network` from `compose_spec::Network`.
- *(compose)* `quadlet::Volume` from `compose_spec::Volume`.
- *(compose)* Kubernetes YAML from `compose_spec::Compose`.
- *(container)* Destructure in Quadlet option conversion.
- *(compose)* Move `podlet compose` args into their own struct.

### Miscellaneous
- *(deps)* Remove `duration-str` dependency.
- All usages were replaced with `compose_spec::duration`.
- Add Podman v5.0.0 to Podman versions.
- Also added v4.9.X aliases to 4.8 and v5.0.X aliases to 5.0.
- *(container)* Reorder fields to match Quadlet docs.
- *(lints)* Fix new rust 1.78 clippy lints.
- **BREAKING** *(release-container)* Push to ghcr.io/containers/podlet.
- The docker.io/k9withabone/podlet and quay.io/k9withabone/podlet container images will no longer be updated.
- *(release-container)* Add annotations/labels to manifest/image.
- Adds labels to the Podlet container image and annotations to the multi-arch manifest as suggested by the GitHub packages documentation: <https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#labelling-container-images>.
- *(ci)* Bump actions/checkout to v4.
- *(ci)* Use Buildah container to build Podlet container.
- *(deps)* Update dependencies.
- *(release)* Update cargo-dist.

## [0.2.4] - 2024-01-30

### Features
Expand Down Expand Up @@ -218,3 +320,12 @@ The initial release of Podlet! Designed for Podman v4.5.0 and newer.
- [Install]
- WantedBy=
- RequiredBy=

[0.3.0]: https://github.com/containers/podlet/compare/v0.2.4...v0.3.0
[0.2.4]: https://github.com/containers/podlet/compare/v0.2.3...v0.2.4
[0.2.3]: https://github.com/containers/podlet/compare/v0.2.2...v0.2.3
[0.2.2]: https://github.com/containers/podlet/compare/v0.2.1...v0.2.2
[0.2.1]: https://github.com/containers/podlet/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/containers/podlet/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/containers/podlet/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/containers/podlet/compare/f9a7aadf5fca4966c3e8c7e6e495749d93029c80...v0.1.0
Loading

0 comments on commit 79d6aa0

Please sign in to comment.