pctl is a cli tool for interacting with Profiles
For operational documentation please visit the Profiles Documentation.
In order to run CLI commands you need a profiles catalog controller up and running along with its API in a cluster.
To get a local setup clone the Profiles repo and run make local-env
.
This will deploy a local kind cluster with the catalog controller and API running. Once the environment is setup
run the following to use pctl against it:
- Create your catalog, for example there is a
examples/profile-catalog-source.yaml
file in the profiles repokubectl apply -f profiles/examples/profile-catalog-source.yaml
- Ensure the current context in kubeconfig is set to the
profiles
cluster (kubectl config current-context
should returnkind-profiles
) - Create a
pctl
binary withmake build
.
In order to keep versioning parity and drift to a minimum with Profiles the following development process must be in place:
- Open a new branch in profiles and create new code
- In
pctl
do areplace
to a local location like this:go mod edit -replace github.com/weaveworks/profiles=<profiles location>
- Work on the changes and once ready, open a PR with this local mod in place
This has the benefit of being really simple, but the counter is that the PR checks will fail because this can't build on CI. The better way is to use a dev tag pin if you want CI to be happy as well for most in-place checks and verifications.
There are some manual steps right now, should be streamlined soon.
Steps:
-
Create a new release notes file:
touch docs/release_notes/<version>.md
-
Copy-and paste the release notes from the draft on the releases page into this file. Note: sometimes the release drafter is a bit of a pain, verify that the notes are correct by doing something like:
git log --first-parent tag1..tag2
. -
Update the
var Version
inpkg/version/release.go
file to be the desired version. -
PR the release notes and version bump into main.
-
Navigate to the
Actions
tab and manually trigger theRelease
job. When the job finishes verify that: -
The release has been created in Github 1. With the correct assets 1. With the correct release notes
-
The image has been pushed to docker
-
The image can be pulled and used in a deployment
Note that <version>
must be in the following format: v0.0.1
.
- Run
make integration
for integration tests (This will set up the required env, no need to do anything beforehand. Note: if you have alocal-env
running and have created profile catalog sources in it, this will influence your tests.) - Run
make unit
for unit tests - Run
make test
to run all tests
There are two configurable values in the integration tests as the time of this writing.
PCTL_TEST_REPOSITORY_URL
-- configures the remote test repository for thecreate-pr
test. This needs to be a repository the user has push access to and access to create a pull request in GitHub.GIT_TOKEN
-- it is used bycreate-pr
test to creating a pull request on GitHub. Without this token the test doesn't run.
See make help
for all development commands.