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

The CLI Client #198

Merged
merged 59 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
59c33ce
feat(cli-client): initial commit
zhijie-yang Jun 4, 2024
54f610e
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Jun 4, 2024
b11fac4
feat(cli-client): full upload trigger generation
zhijie-yang Jun 5, 2024
3ac8eeb
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Jun 5, 2024
012d346
feat(cli-client): get run id from workflow ext ref id
zhijie-yang Jun 5, 2024
50e962b
feat(cli-client): finalize workflow dispatcher
zhijie-yang Jun 5, 2024
bcb69f6
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Jun 5, 2024
58128a1
feat(cli-client) add poller for workflow run status
zhijie-yang Jun 6, 2024
bbfd44d
feat(cli-client): optimize token management
zhijie-yang Jun 6, 2024
cb41fca
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Jun 6, 2024
6742f5d
feat(cli-client): display current job for poller
zhijie-yang Jun 7, 2024
e7ea085
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Jun 7, 2024
3698b74
chore(ci): disable mock-rock CI for cli-client
zhijie-yang Jun 7, 2024
083e7df
ci: automatically update oci/mock-rock/_releases.json, from https://g…
Jun 7, 2024
4d381f5
fix(cli-client): workflow dispatch returns 204
zhijie-yang Jun 10, 2024
c105f6e
fix(cli-client): fix poller not updating runs list
zhijie-yang Jun 10, 2024
be365dc
feat(cli-client): get image name by rockcraft.yaml
zhijie-yang Jun 10, 2024
34d1827
fix(cli-client): add missing version field
zhijie-yang Jun 10, 2024
ac07b65
feat(cli-client): add basic cli parser
zhijie-yang Jun 10, 2024
d7b29e5
feat(cli-client): full go-flags parser for upload
zhijie-yang Jun 11, 2024
6232b6e
test(cli-client): add test for trigger and dispatcher
zhijie-yang Jun 11, 2024
dcedd24
refactor(cli-client): refactor client for testability
zhijie-yang Jun 13, 2024
edf6f07
test(cli-client): add tests for client, validator and tokens
zhijie-yang Jun 13, 2024
a06df9d
doc(cli-client): add readme
zhijie-yang Jun 13, 2024
d842db5
chore(cli-client): change panic to println
zhijie-yang Jun 14, 2024
242ac2c
docs(cli-client): updated README
zhijie-yang Jun 24, 2024
3b72ff2
Merge branch 'main' into ROCKS-1216-cli-client
zhijie-yang Jun 24, 2024
f697e50
fix(cli-client): fix the code styling accord. to review
zhijie-yang Jun 24, 2024
cbfdc97
fix(cli-client): update test and function visibility acc. to review
zhijie-yang Jun 24, 2024
54b8ca6
feat(cli-client): use regex to find release args and add test
zhijie-yang Jun 24, 2024
d444410
fix(cli-client): multiple adjustments according to code review
zhijie-yang Jun 25, 2024
9490c9d
refactor(cli-client): change tacks to track for cmd
zhijie-yang Jun 25, 2024
2a4791a
test(cli-client): reformed tests with go check
zhijie-yang Jun 25, 2024
14f64e6
refactor(cli-client): use defer to restore injected variable
zhijie-yang Jun 27, 2024
0c81222
feat(cli-client): use kv pair to parse upload cmd
zhijie-yang Jun 28, 2024
7c7d675
doc(cli-client): update readme accord. code review
zhijie-yang Jul 2, 2024
18061b4
fix(cli-client): fix accord. to code review
zhijie-yang Jul 2, 2024
e0a2336
feat(cli-client): add 503 retry for SendRequest
zhijie-yang Jul 2, 2024
f5c68dc
chore(cli-client): comment out not impl.'ed release cmd
zhijie-yang Jul 3, 2024
f43d41d
chore(cli-client): add description help msg
zhijie-yang Jul 3, 2024
3dcd613
chore(cli-client): update go module
zhijie-yang Jul 4, 2024
cc2b88a
fix(cli-client): resolve golint err
zhijie-yang Jul 4, 2024
c0fe424
build(cli-client): add test workflow
zhijie-yang Jul 4, 2024
f1c56e4
doc(cli-client): add cli client in root README
zhijie-yang Jul 4, 2024
b12ffe5
doc(cli-client): fix hyperlink in root README
zhijie-yang Jul 5, 2024
ecd99fb
build(cli-client): ROCKS-1274 add snap pack
zhijie-yang Jul 12, 2024
0aae871
feat(cli-client): make unauthorized error more friendly
zhijie-yang Jul 12, 2024
f4359f4
refactor(cli-client): rename cli workflow as internal
zhijie-yang Jul 12, 2024
b0d144f
chore(ci): use working-directory in workflow
zhijie-yang Jul 12, 2024
49ac137
doc(cli-client): update from code reivew
zhijie-yang Jul 12, 2024
ef30468
build(cli-client): use . as build source
zhijie-yang Jul 12, 2024
b7d61f5
docs(cli): move install client outside of deps
zhijie-yang Jul 12, 2024
e48824f
chore(cli): go mod tidy
zhijie-yang Jul 15, 2024
d25d8ef
feat(cli): enhance err handling in cli_main
zhijie-yang Jul 15, 2024
a2479a1
feat(cli): handle 'help' command
zhijie-yang Jul 15, 2024
db12a9a
feat(cli): enhance error handling
zhijie-yang Jul 15, 2024
b819f16
chore(cli): update the long desc of upload cmd
zhijie-yang Jul 15, 2024
7a6e701
ci(cli): add snap build for cli client
zhijie-yang Jul 16, 2024
c541687
feat(cli): use AddCommand directly from parser
zhijie-yang Jul 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
with:
go-version: 1.22
- name: Test
working-directory: src/cli-client
run: |
cd src/cli-client
go test ./...
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ Pull Requests 🚀.

### As a **Maintainer** ⛏ 🪨

There are two ways to use the OCI Factory to build the images.
Maintainers can request new image builds and releases by either creating
Pull Requests (PRs) or via the OCI Factory CLI Client.

#### 1. With Pull Requests

Expand All @@ -93,11 +94,13 @@ multiple images;
Maintainers can use the OCI Factory's CLI Client to interact with the OCI
Factory. The CLI Client is a Go module at [src/cli-client](src/cli-client).

Here's what you should do and know before you use the CLI Client to trigger
the first build of your image:
Here's what you should do and know before you use the CLI Client:

1. you are onboard as a Maintainer, and have received your token to the CLI
Client;
1. you **must** already be an onboarded Maintainer and have had significant
interactions with the OCI Factory (via PRs). Why is that? To use this client
you'll be granted write permissions to the repository, and thus you'll have
escalated rights when compared to a regular Maintainer - with great power
comes great maintainability,
2. each use of the CLI Client **must** only target one version of an OCI image,
i.e. you can ask the OCI Factory to build one version of the image, upload and
release it to GHCR, Docker Hub, and ECR with different tracks, risks and EOL with
Expand Down
31 changes: 28 additions & 3 deletions src/cli-client/README.md
zhijie-yang marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,35 @@ The user will be asked to input the GitHub Personal Access Token upon triggering
terminal, it is possible to assign the token to the environmental variable `export GITHUB_TOKEN=<your token>`, and pass
`-y` to confirm the triggering by default.

### Installation
### Install using Snap

```bash
sudo snap install oci-factory
```

### Install using Go

#### Dependencies
zhijie-yang marked this conversation as resolved.
Show resolved Hide resolved

```bash
# install git
sudo apt update && sudo apt install -y git
```

Golang-go can be installed either with APT or Snap:

```bash
# install golang-go with apt
sudo apt update && sudo apt install -y golang-go
```

```bash
# install golang-go with snap
sudo snap install go --classic
```

Now install the CLI client
```bash
git clone https://github.com/canonical/oci-factory.git
cd oci-factory/src/cli-client
go install github.com/canonical/oci-factory/src/cli-client/cmd/oci-factory
```

Expand Down
8 changes: 1 addition & 7 deletions src/cli-client/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ parts:
oci-factory:
plugin: go
build-snaps: [go/latest/stable]
source: https://github.com/canonical/oci-factory
source-type: git
source-subdir: src/cli-client/cmd/oci-factory
source: .
stage-packages:
- git
# TODO remove this override-pull when the branch is merged
override-pull: |
snapcraftctl pull
git checkout ROCKS-1216-cli-client

apps:
oci-factory:
Expand Down
Loading