Skip to content
/ pctl Public
forked from weaveworks/pctl

CLI for interacting with profiles

License

Notifications You must be signed in to change notification settings

Himangini/pctl

 
 

Repository files navigation

pctl

pctl is a cli tool for interacting with Profiles

Usage

For operational documentation please visit the Profiles Documentation.

Contributing

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:

  1. Create your catalog, for example there is a examples/profile-catalog-source.yaml file in the profiles repo kubectl apply -f profiles/examples/profile-catalog-source.yaml
  2. Ensure the current context in kubeconfig is set to the profiles cluster (kubectl config current-context should return kind-profiles)
  3. Create a pctl binary with make build.

Working with profiles

In order to keep versioning parity and drift to a minimum with Profiles the following development process must be in place:

Using local pin

  • Open a new branch in profiles and create new code
  • In pctl do a replace 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.

Release process

There are some manual steps right now, should be streamlined soon.

Steps:

  1. Create a new release notes file:

    touch docs/release_notes/<version>.md
  2. 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.

  3. Update the var Version in pkg/version/release.go file to be the desired version.

  4. PR the release notes and version bump into main.

  5. Navigate to the Actions tab and manually trigger the Release job. When the job finishes verify that:

  6. The release has been created in Github 1. With the correct assets 1. With the correct release notes

  7. The image has been pushed to docker

  8. The image can be pulled and used in a deployment

Note that <version> must be in the following format: v0.0.1.

Tests

  1. Run make integration for integration tests (This will set up the required env, no need to do anything beforehand. Note: if you have a local-env running and have created profile catalog sources in it, this will influence your tests.)
  2. Run make unit for unit tests
  3. Run make test to run all tests

Configuring Integration Tests

There are two configurable values in the integration tests as the time of this writing.

  1. PCTL_TEST_REPOSITORY_URL -- configures the remote test repository for the create-pr test. This needs to be a repository the user has push access to and access to create a pull request in GitHub.
  2. GIT_TOKEN -- it is used by create-pr test to creating a pull request on GitHub. Without this token the test doesn't run.

See make help for all development commands.

About

CLI for interacting with profiles

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.6%
  • Other 1.4%