Skip to content

Commit

Permalink
Merge branch 'release/v0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
moooofly committed Jul 23, 2018
2 parents aecbcfa + 5a670e1 commit 5752a16
Show file tree
Hide file tree
Showing 5 changed files with 585 additions and 66 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v0.9.0 (2018-7-23)

### New Features

* Add all users APIs

### Improvements

### Bug Fixes

## v0.8.0 (2018-7-11)

### New Features
Expand Down
32 changes: 26 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ ifeq "$(GOPATH)" ""
$(error Please set the environment variable GOPATH before running `make`)
endif

GO := go
PKGS := $(shell $(GO) list ./... | grep -v vendor)
GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)
GO := go
PKGS := $(shell $(GO) list ./... | grep -v vendor)
# NOTE: '-race' requires cgo; enable cgo by setting CGO_ENABLED=1
#BUILD_FLAG := -race
GOBUILD := CGO_ENABLED=0 $(GO) build $(BUILD_FLAG)

LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.ClientVersion=$(shell cat VERSION)"
LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.GoVersion=$(shell go version)"
Expand All @@ -16,45 +18,63 @@ LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.GitBranch=$(shell git
LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.GitTag=$(shell git describe --tags)"
LDFLAGS += -X "github.com/moooofly/harbor-go-client/utils.GitHash=$(shell git rev-parse HEAD)"

.PHONY: all build install lint test pack docker misspell shellcheck clean

all: lint build test

build:
@echo "==> Building ..."
$(GOBUILD) -ldflags '$(LDFLAGS)' ./
@echo ""

install:
@echo "==> Installing ..."
$(GO) install -x ${SRC}
@echo ""

lint:
@# gometalinter - Concurrently run Go lint tools and normalise their output
@# - go get -u github.com/alecthomas/gometalinter (Install from HEAD)
@# - gometalinter --install (Install all known linters)
@echo "==> Running gometalinter ..."
gometalinter --exclude=vendor --disable-all --enable=golint --enable=vet --enable=gofmt --enable=misspell ./...
find . -name '*.go' -not -path "./vendor/*" | xargs gofmt -w -s
@echo ""

test:
@echo "==> Testing ..."
$(GO) test -short -race $(PKGS)
@echo ""

pack: build
@echo "==> Packing ..."
@tar czvf $(shell cat VERSION)-bin.tar.gz harbor-go-client conf/*.yaml
@echo ""
@rm harbor-go-client
@echo ""

docker:
@echo "==> Creating docker image ..."
docker build -t harbor-go-client:$(shell git rev-parse --short HEAD) .
@echo ""

misspell:
# misspell - requires that the following be run first:
# go get -u github.com/client9/misspell/cmd/misspell
@# misspell - Correct commonly misspelled English words in source files
@# go get -u github.com/client9/misspell/cmd/misspell
@echo "==> Runnig misspell ..."
find . -name '*.go' -not -path './vendor/*' -not -path './_repos/*' | xargs misspell -error
@echo ""

shellcheck:
# apt-get install -y shellcheck
@# apt-get install -y shellcheck
@echo "==> Runnig shellcheck ..."
shellcheck ./scripts/*.sh
@echo ""

clean:
@echo "==> Cleaning ..."
$(GO) clean -x -i ${SRC}
rm -rf *.out
rm -rf *.tar.gz
@echo ""

167 changes: 119 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,126 @@ This project offer a command-line interface to the Harbor API, you can use it to

## Features

Current support following Harbor REST APIs:
Current Harbor API support status:

- Login
- POST /login
- [x] POST /login
- Logout
- GET /logout
- Search
- GET /api/search
- Projects
- GET /api/projects
- DELETE /api/projects/{prject_id}
- Repositories
- DELETE /api/repositories/{repo_name}
- GET /api/repositories
- GET /api/repositories/top
- DELETE /api/repositories/{repo_name}/tags/{tag}
- GET /api/repositories/{repo_name}/tags/{tag}
- GET /api/repositories/{repo_name}/tags
- Uses
- GET /api/users/current
- Targets
- POST /api/targets
- DELETE /api/targets/{id}
- GET /api/targets/{id}
- PUT /api/targets/{id}
- GET /api/targets
- POST /api/targets/ping
- POST /api/targets/{id}/ping
- GET /api/targets/{id}/policies/
- Configurations
- PUT /api/configurations
- GET /api/configurations
- POST /api/configurations/reset
- Logs
- GET /api/logs
- Statistics
- GET /api/statistics
- Systeminfo
- GET /api/systeminfo
- GET /api/systeminfo/volumes
- GET /api/systeminfo/getcert


Current support following custom feature:

- rp_analysis: Run retention policy analysis, do some soft deletion as you command, prompt user performing a GC.
- [x] GET /logout
- search
- [x] GET /api/search
- projects
- [x] GET /api/projects
- [ ] HEAD /api/projects
- [x] POST /api/projects
- [x] DELETE /api/projects/{prject_id}
- [x] GET /api/projects/{prject_id}
- [ ] PUT /api/projects/{prject_id}
- [ ] GET /api/projects/{prject_id}/logs
- [ ] GET /api/projects/{prject_id}/metadatas
- [ ] POST /api/projects/{prject_id}/metadatas
- [ ] DELETE /api/projects/{prject_id}/metadatas/{meta_name}
- [ ] GET /api/projects/{prject_id}/metadatas/{meta_name}
- [ ] PUT /api/projects/{prject_id}/metadatas/{meta_name}
- [ ] GET /api/projects/{prject_id}/members
- [ ] POST /api/projects/{prject_id}/members
- [ ] DELETE /api/projects/{prject_id}/members/{mid}
- [ ] GET /api/projects/{prject_id}/members/{mid}
- [ ] PUT /api/projects/{prject_id}/members/{mid}
- statistics
- [x] GET /api/statistics
- users
- [x] GET /api/users
- [x] POST /api/users
- [x] GET /api/users/current
- [x] DELETE /api/users/{user_id}
- [x] GET /api/users/{user_id}
- [x] PUT /api/users/{user_id}
- [x] PUT /api/users/{user_id}/password
- [x] PUT /api/users/{user_id}/sysadmin
- repositories
- [x] GET /api/repositories
- [x] DELETE /api/repositories/{repo_name}
- [ ] PUT /api/repositories/{repo_name}
- [ ] GET /api/repositories/{repo_name}/labels
- [ ] POST /api/repositories/{repo_name}/labels
- [ ] DELETE /api/repositories/{repo_name}/labels/{label_id}
- [x] DELETE /api/repositories/{repo_name}/tags/{tag}
- [x] GET /api/repositories/{repo_name}/tags/{tag}
- [x] GET /api/repositories/{repo_name}/tags
- [ ] GET /api/repositories/{repo_name}/tags/{tag}/labels
- [ ] POST /api/repositories/{repo_name}/tags/{tag}/labels
- [ ] DELETE /api/repositories/{repo_name}/tags/{tag}/labels/{label_id}
- [ ] GET /api/repositories/{repo_name}/tags/{tag}/manifest
- [ ] POST /api/repositories/{repo_name}/tags/{tag}/scan
- [ ] GET /api/repositories/{repo_name}/tags/{tag}/vulnerability/details
- [ ] GET /repositories/{repo_name}/signatures
- [x] GET /api/repositories/top
- logs
- [x] GET /api/logs
- jobs
- [x] GET /api/jobs/replication
- [x] PUT /api/jobs/replication
- [x] DELETE /api/jobs/replication/{id}
- [x] GET /api/jobs/replication/{id}/log
- [x] GET /api/jobs/scan/{id}/log
- policies
- [ ] GET /api/policies/replication
- [ ] POST /api/policies/replication
- [ ] GET /api/policies/replication/{id}
- [ ] PUT /api/policies/replication/{id}
- labels
- [ ] GET /api/labels
- [ ] POST /api/labels
- [ ] DELETE /api/labels/{id}
- [ ] GET /api/labels/{id}
- [ ] PUT /api/labels/{id}
- replications
- [ ] POST /api/replications
- targets
- [x] GET /api/targets
- [x] POST /api/targets
- [x] POST /api/targets/ping
- [x] POST /api/targets/{id}/ping (deprecated)
- [x] DELETE /api/targets/{id}
- [x] GET /api/targets/{id}
- [x] PUT /api/targets/{id}
- [x] GET /api/targets/{id}/policies/
- internal
- [ ] POST /api/internal/syncregistry
- systeminfo
- [x] GET /api/systeminfo
- [x] GET /api/systeminfo/volumes
- [x] GET /api/systeminfo/getcert
- ldap
- [ ] POST /api/ldap/ping
- [ ] GET /api/ldap/groups/search
- [ ] GET /api/ldap/users/search
- [ ] POST /api/ldap/users/import
- usergroups
- [ ] GET /api/usergroups
- [ ] POST /api/usergroups
- [ ] DELETE /api/usergroups/{group_id}
- [ ] GET /api/usergroups/{group_id}
- [ ] PUT /api/usergroups/{group_id}
- configurations
- [x] GET /api/configurations
- [x] PUT /api/configurations
- [x] POST /api/configurations/reset
- email
- [ ] POST /api/email/ping


Additional features supported:

- rp_tags: Do tags deletion on repositories according to retention policy.
- rp_repos: Do soft deletion on repositories according to retention policy (prompt user performing a GC after that).

## Installation

```
go get -u github.com/moooofly/harbor-go-client
```

## Quick Start

- lint + build + test
Expand Down Expand Up @@ -99,15 +166,19 @@ make test

## Documentation

See [docs](https://github.com/moooofly/harbor-go-client/tree/master/docs)

## Testing

You can run integration test with [scripts/regression_test.sh](https://github.com/moooofly/harbor-go-client/blob/master/scripts/regression_test.sh) (Assuming local Harbor installation)

## Auxiliaries Coverage

- [ ] go test
- [x] CI (gitlab-ci & travis-ci)
- [ ] dockerization
- [ ] godoc
- [x] test.sh colorful output
- [x] integration test (by `scripts/*.sh`)
- [x] CI (by travis-ci)
- [x] dockerization
- [x] godoc (need to optimize)
- [x] glide support
- [x] sql-like result output

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.8.0
v0.9.0
Loading

0 comments on commit 5752a16

Please sign in to comment.