Skip to content

Commit

Permalink
Merge branch 'main' into issue-145
Browse files Browse the repository at this point in the history
Signed-off-by: Vadim Bauer <[email protected]>
  • Loading branch information
Vad1mo authored Sep 24, 2024
2 parents 719cfd4 + 37a6ab4 commit 5968399
Show file tree
Hide file tree
Showing 23 changed files with 756 additions and 554 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dagger.gen.go linguist-generated
/internal/dagger/** linguist-generated
/internal/querybuilder/** linguist-generated
/internal/telemetry/** linguist-generated
25 changes: 25 additions & 0 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Docker Publish

on:
push:
branches: [docker-publish]
pull_request:
paths-ignore:
- '*.md'

jobs:
docker-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Call Docker-Publish Function
uses: dagger/[email protected]
with:
version: "latest"
verb: call
module: github.com/bishal7679/[email protected]
args: docker-publish --directory-arg=. --cosign-key=${{ secrets.COSIGN_KEY }} --cosign-password=${{ env.COSIGN_PASSWORD }} --reg-username=${{ env.REGISTRY_USERNAME }} --reg-password=${{ env.REGISTRY_PASSWORD }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ go.work

/harbor
dist/
/dagger.gen.go
/internal/*
37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,37 +100,32 @@ Windows | ✅

# Installation

## Build From Source

```bash
git clone https://github.com/goharbor/harbor-cli.git
cd harbor-cli/cmd/harbor
go build .
sudo mv harbor /usr/local/bin/
```

## Linux and MacOS

use `amd64/arm64` as per your system architecture
Homebrew is the recommended way to install Harbor CLI on MacOS and Linux.

```bash
## Linux
tar -xzf harbor_0.0.1_linux_amd64.tar.gz
cd harbor_0.0.1_linux_amd64
sudo mv harbor /usr/local/bin/

## MacOS
tar -xzf harbor_0.0.1_darwin_amd64.tar.gz
cd harbor_0.0.1_darwin_amd64
sudo mv harbor /usr/local/bin/
```

## Windows

```bash
```shell

winget install harbor

```



# Build From Source

Make sure you have latest [Dagger](https://docs.dagger.io/) installed in your system.

```bash
git clone https://github.com/goharbor/harbor-cli.git
dagger call build
```


# Community

* **Twitter:** [@project_harbor](https://twitter.com/project_harbor)
Expand Down
5 changes: 2 additions & 3 deletions cmd/harbor/root/artifact/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/utils"
artifactViews "github.com/goharbor/harbor-cli/pkg/views/artifact/list"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand All @@ -30,9 +31,7 @@ func ListArtifactCommand() *cobra.Command {
if err != nil {
log.Errorf("failed to list artifacts: %v", err)
}

log.Infof("Artifacts: %v", resp)

artifactViews.ListArtifacts(resp.Payload)
},
}

Expand Down
5 changes: 1 addition & 4 deletions cmd/harbor/root/project/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ func CreateProjectCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "create [project name]",
Short: "create project",
Args: cobra.ExactArgs(1),
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
opts.ProjectName = args[0]
var err error
createView := &create.CreateView{
ProjectName: opts.ProjectName,
Expand All @@ -28,8 +27,6 @@ func CreateProjectCommand() *cobra.Command {
if len(args) > 0 {
opts.ProjectName = args[0]
err = api.CreateProject(opts)
} else if opts.ProjectName != "" && opts.RegistryID != "" && opts.StorageLimit != "" {
err = api.CreateProject(opts)
} else {
err = createProjectView(createView)
}
Expand Down
11 changes: 7 additions & 4 deletions cmd/harbor/root/user/elevate.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/goharbor/harbor-cli/pkg/api"
"github.com/goharbor/harbor-cli/pkg/prompt"
"github.com/goharbor/harbor-cli/pkg/views"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand All @@ -25,10 +26,12 @@ func ElevateUserCmd() *cobra.Command {
userId = prompt.GetUserIdFromUser()
}

// Todo : Ask for the confirmation before elevating the user to admin role

err = api.ElevateUser(userId)

confirm, err := views.ConfirmElevation()
if confirm {
err = api.ElevateUser(userId)
} else {
log.Error("Permission denied for elevate user to admin.")
}
if err != nil {
log.Errorf("failed to elevate user: %v", err)
}
Expand Down
221 changes: 0 additions & 221 deletions dagger.gen.go

This file was deleted.

9 changes: 8 additions & 1 deletion dagger.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"name": "harbor-cli",
"sdk": "go",
"engineVersion": "v0.12.3"
"dependencies": [
{
"name": "cosign",
"source": "github.com/scottames/daggerverse/cosign@8359122a7b90f2c8c6f3165570fdcbec6e923023"
}
],
"source": ".",
"engineVersion": "v0.13.3"
}
Loading

0 comments on commit 5968399

Please sign in to comment.