wolfi-dev / wolfi-dev/wolfictl
Proposal: Introduce a new `init` subcommand to enhange developer experience for adding new packages (with ChatGPT)
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 73
- Forks
- 86
- Avg merge
- 7d 7h
- Merged PRs (30d)
- 15
Description
With @developer-guy, we thought an idea to enhance overall developer productivity when adding a brand-new packages. Find the proposal below.
Abstract
Introduce a new init sub-command to significantly improve the developer experience for all the contributors by creating automated package templates for both Chainguard Image and Wolfi Package.
Motivation
Currently, creating a new package from scratch is time-consuming since developers have to find-out for information (license, version, descrption, etc.) of the packages from the upstream repositories. There could be an automated way to tackle this problem. We can save tons of hours!
Implementation
Option 1 (interactive)
After running wolfictl init, you can choose one of the following templates:
melange: Suitable for a Wolfi package by creatingmelange.yaml.apko: Suitable for a Chainguard Image by creatingapko.yaml.
End user should use arrow to move.
- Use the GitHub API to fetch all the required information from the repository to use as default values
- Ask the prompts:
Name:,Description,License, etc. (with default values) - As soon as we gathered all the needs, ask a final
[Y/n]question to initialize the package template. - Enlight the way of the developer by printing very descriptive logs. (directory it was created, what to do next, etc.)
1: If melange selected
- Create a
<NAME>.yamlwith following template: - Optional: Fetch
APKBUILDfile by searhing https://git.alpinelinux.org/ (or https://search.nixos.org/packages to getpropagatedBuildInputs) and call OpenAI API (by using ChatGPT) to read and convert the file content to melange corresponding (if possible) - Optional: If it's Go image, run Grype for the image and append
go getcommands to mitigate CVEs inrunspipeline - Include the package in
packages.txt(at random line to prevent conflict)
package:
name: NAME
version: LAST VERSION
epoch: 0
description: GITHUB DESCRIPTION
copyright:
- license: GITHUB LICENSE
environment:
contents:
packages:
- wolfi-base
- busybox
- ca-certificates-bundle
- build-base
pipeline:
- uses: fetch
with:
uri: UPSTREAM REPO/${{package.version}}.tar.gz
expected-sha256: EXPECTED SHA
expected-commit: EXPECTED COMMIT
- runs: |
# TODO
- uses: strip
update:
enabled: SET TRUE IF ACTIVELY MAINTAINED REPO (IF LAST COMMIT DATE < 1y)
github:
identifier: REPO/PROJECT
use-tag: true
tag-filter: "TAG"
2: If apko selected
- Init a new package tree:
PACKAGE NAME
├──configs
│ └──latest.apko.yaml
├──image.yaml
├──README.md
└──tests
├──01-runs.sh
- In the directory, init
image.yamlandREADME.mdthe the following templates:
status: experimental
versions:
- apko:
config: configs/latest.apko.yaml
extractTagsFrom:
package: PACKAGE
subvariants:
- suffix: -dev
options:
- dev
- To fill
configs/latest.apko.yamlfile, we can get thewolfi/ospackage corresponding if exist. (if doesn't we can error out: "Wolfi package is not exist. Create it first to initialize a new apko file):
contents:
repositories:
- https://packages.wolfi.dev/os
keyring:
- https://packages.wolfi.dev/os/wolfi-signing.rsa.pub
packages:
- ca-certificates-bundle
- wolfi-baselayout
- PACKAGE NAME
accounts:
groups:
- groupname: nonroot
gid: 65532
users:
- username: nonroot
uid: 65532
gid: 65532
run-as: 65532
entrypoint:
command: /usr/bin/PACKAGE (or auto-detect)
archs:
- x86_64
- aarch64
annotations:
"org.opencontainers.image.authors": "Chainguard Team https://www.chainguard.dev/"
"org.opencontainers.image.url": https://edu.chainguard.dev/chainguard/chainguard-images/reference/PACKAGE/
"org.opencontainers.image.source": https://github.com/chainguard-images/images/tree/main/images/PACKAGE
-
Search for
Dockerfilein upstream repo to fill outentrypointandmetadatafields -
Create a
02-helm.shif possible. Use the ArtifactHub to search Helm package corresponding and in case we find something, append the Helm testing template: (this is a bit tricky since we have to parse thevalues.yamlto findimage.repositoryandimage.tagfields)
$ helm repo add PACKAGE_NAME REPO_ADDR
$ helm upgrade --install PACKAGE_NAME \
REPO/PACKAGE \
--set image.repository=cgr.dev/chainguard/PACKAGE \
--set image.tag=latest-arm64
README: Like this, in the ## Using PACKAGE we can put the entire README here (or auto-find the Usage section if exist, or maybe custom template, or we can even use ChatGPT!)
IDEA: In the future iteration of this sub-command, we can include additional templates for each language (Go, Node, Python, etc.).
Option 2
Same with Option 1, but do not use prompts. Override with given flags instead.
- `wolfictl init melange [OPTIONS]
- `wolfictl init apko [OPTIONS]
Open Questions
- Should these sub-command only work if active working directory is
chainguard-images/imagesorwolfi/os? - Does it make sense in overall?
- Would this CLI repo is right place for such a this feature? (Since the context of this CLI is mostly for Wolfi; what about
monopod?) - Any ongoing work or proposal for this? (or maybe similar idea)
/cc @jdolitsky @patflynn @dlorenc
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Start by reviewing the existing wolfictl subcommands and package-generation flow, then resolve the open questions and choose a bounded melange or apko scope. Done should include agreed prompts or flags, generated templates, and defined checks for the external lookups and resulting files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100