diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index f21cdbcc..37184bf7 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -31,12 +31,13 @@ jobs: - name: Check for changes run: | - # Check if any untracked files exist + # Check if any newly added docs exist untracked_files=$(git ls-files --others --exclude-standard) # If there are untracked files, fail the workflow if [ -n "$untracked_files" ]; then - echo "Untracked files found:" + echo "New Untracked files found" + echo "please check if docs were added for new commands" echo "$untracked_files" exit 1 # This will fail the workflow else @@ -49,14 +50,25 @@ jobs: with: version: ${{ steps.dagger_version.outputs.version }} verb: call - args: lint-report export --path=golangci-lint-report.sarif + args: lint-report export --path=golangci-lint.report - - uses: reviewdog/action-setup@v1 - - name: Run Reviewdog - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Generate lint summary run: | - reviewdog -f=sarif -name="Golang Linter Report" -reporter=github-check -filter-mode nofilter -fail-level any -tee < golangci-lint-report.sarif + echo "

📝 Lint results

" >> $GITHUB_STEP_SUMMARY + cat golangci-lint.report >> $GITHUB_STEP_SUMMARY + # Check if the lint report contains any content (error or issues) + if [ -s golangci-lint.report ]; then + # If the file contains content, output an error message and exit with code 1 + echo "⚠️ Linting issues found!" >> $GITHUB_STEP_SUMMARY + exit 1 + fi + + # - uses: reviewdog/action-setup@v1 + # - name: Run Reviewdog + # env: + # REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: | + # reviewdog -f=sarif -name="Golang Linter Report" -reporter=github-check -filter-mode nofilter -fail-level any -tee < golangci-lint-report.sarif test-code: runs-on: ubuntu-latest @@ -71,7 +83,12 @@ jobs: with: version: ${{ steps.dagger_version.outputs.version }} verb: call - args: test + args: test-report export --path=TestReport.json + + - name: Summarize Tests + uses: robherley/go-test-action@v0.6.0 + with: + fromJSONFile: TestReport.json - name: Build Binary uses: dagger/dagger-for-github@v7 @@ -81,67 +98,85 @@ jobs: args: build-dev --platform linux/amd64 export --path=./harbor-dev push-latest-images: - - name: Print GitHub ref for debugging - run: echo "GitHub ref: $GITHUB_REF" - - - name: Push images - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - needs: - - lint - - test-code - permissions: - contents: read - id-token: write - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Publish and Sign Snapshot Image - uses: ./.github/actions/publish-and-sign - with: - IMAGE_TAGS: latest - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} - REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }} - REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME }} + needs: + - lint + - test-code + permissions: + contents: read + id-token: write + runs-on: ubuntu-latest + steps: + - name: Print GitHub ref for debugging + run: | + echo "GitHub ref: $GITHUB_REF" + + - name: Push images + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + run: | + echo "Pushing images..." + + - name: Checkout repo + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Publish and Sign Snapshot Image + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + uses: ./.github/actions/publish-and-sign + with: + IMAGE_TAGS: latest + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }} + REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME }} publish-release: - - name: Print GitHub ref for debugging - run: echo "GitHub ref: $GITHUB_REF" - - - name: Push images - if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) - needs: - - lint - - test-code - permissions: - contents: write - packages: write - id-token: write - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Create Release - uses: dagger/dagger-for-github@v7 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - version: "latest" - verb: call - args: "release --github-token=env:GITHUB_TOKEN" - - - name: Publish and Sign Tagged Image - if: success() - uses: ./.github/actions/publish-and-sign - with: - IMAGE_TAGS: "latest, ${{ github.ref_name }}" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} - REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }} - REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME }} + needs: + - lint + - test-code + permissions: + contents: write + packages: write + id-token: write + runs-on: ubuntu-latest + steps: + - name: Print GitHub ref for debugging + run: | + echo "GitHub ref: $GITHUB_REF" + + - name: Push images + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + uses: ./.github/actions/publish-and-sign + with: + IMAGE_TAGS: latest, ${{ github.ref_name }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }} + REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME }} + + - name: Checkout repo + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Create Release + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + uses: dagger/dagger-for-github@v7 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + version: "latest" + verb: call + args: "release --github-token=env:GITHUB_TOKEN" + + - name: Publish and Sign Tagged Image + if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) + uses: ./.github/actions/publish-and-sign + with: + IMAGE_TAGS: "latest, ${{ github.ref_name }}" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }} + REGISTRY_USERNAME: ${{ vars.REGISTRY_USERNAME }} diff --git a/.golangci.yaml b/.golangci.yaml index fb281a93..d72eb136 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -27,6 +27,13 @@ linters: - errcheck - staticcheck - dupl + - goheader + - misspell + - ineffassign + - whitespace + - bodyclose + - govet + - stylecheck # - wrapcheck # - gocritic # - revive #, enable once current issues are resolved diff --git a/cmd/harbor/internal/version/version.go b/cmd/harbor/internal/version/version.go index b89de17a..a9012f00 100644 --- a/cmd/harbor/internal/version/version.go +++ b/cmd/harbor/internal/version/version.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package version import "runtime/debug" diff --git a/cmd/harbor/main.go b/cmd/harbor/main.go index 08f13845..98ffff65 100644 --- a/cmd/harbor/main.go +++ b/cmd/harbor/main.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main import ( diff --git a/cmd/harbor/root/artifact/cmd.go b/cmd/harbor/root/artifact/cmd.go index 8f9c66d2..c3638de3 100644 --- a/cmd/harbor/root/artifact/cmd.go +++ b/cmd/harbor/root/artifact/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package artifact import ( @@ -5,7 +18,6 @@ import ( ) func Artifact() *cobra.Command { - cmd := &cobra.Command{ Use: "artifact", Short: "Manage artifacts", diff --git a/cmd/harbor/root/artifact/delete.go b/cmd/harbor/root/artifact/delete.go index d2dc82ea..e835d555 100644 --- a/cmd/harbor/root/artifact/delete.go +++ b/cmd/harbor/root/artifact/delete.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package artifact import ( diff --git a/cmd/harbor/root/artifact/list.go b/cmd/harbor/root/artifact/list.go index d343faf7..c62ad367 100644 --- a/cmd/harbor/root/artifact/list.go +++ b/cmd/harbor/root/artifact/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package artifact import ( diff --git a/cmd/harbor/root/artifact/scan.go b/cmd/harbor/root/artifact/scan.go index 34cea8da..c3f616ba 100644 --- a/cmd/harbor/root/artifact/scan.go +++ b/cmd/harbor/root/artifact/scan.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package artifact import ( diff --git a/cmd/harbor/root/artifact/tags.go b/cmd/harbor/root/artifact/tags.go index a213b3c7..940d5ff9 100644 --- a/cmd/harbor/root/artifact/tags.go +++ b/cmd/harbor/root/artifact/tags.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package artifact import ( @@ -92,7 +105,6 @@ func ListTagsCmd() *cobra.Command { } else { list.ListTags(tags.Payload) } - }, } diff --git a/cmd/harbor/root/artifact/view.go b/cmd/harbor/root/artifact/view.go index a16531b0..99596d05 100644 --- a/cmd/harbor/root/artifact/view.go +++ b/cmd/harbor/root/artifact/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package artifact import ( @@ -12,7 +25,6 @@ import ( ) func ViewArtifactCommmand() *cobra.Command { - cmd := &cobra.Command{ Use: "view", Short: "Get information of an artifact", @@ -48,7 +60,6 @@ func ViewArtifactCommmand() *cobra.Command { } else { view.ViewArtifact(artifact.Payload) } - }, } diff --git a/cmd/harbor/root/cmd.go b/cmd/harbor/root/cmd.go index 1bdc448d..72b11eca 100644 --- a/cmd/harbor/root/cmd.go +++ b/cmd/harbor/root/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package root import ( diff --git a/cmd/harbor/root/health.go b/cmd/harbor/root/health.go index cf7b0f26..04b844bf 100644 --- a/cmd/harbor/root/health.go +++ b/cmd/harbor/root/health.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package root import ( @@ -26,5 +39,4 @@ func HealthCommand() *cobra.Command { } return cmd - } diff --git a/cmd/harbor/root/labels/cmd.go b/cmd/harbor/root/labels/cmd.go index 8874532d..061504e6 100644 --- a/cmd/harbor/root/labels/cmd.go +++ b/cmd/harbor/root/labels/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package labels import "github.com/spf13/cobra" diff --git a/cmd/harbor/root/labels/create.go b/cmd/harbor/root/labels/create.go index a336f1de..ddb3c88b 100644 --- a/cmd/harbor/root/labels/create.go +++ b/cmd/harbor/root/labels/create.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package labels import ( @@ -33,7 +46,6 @@ func CreateLabelCommand() *cobra.Command { if err != nil { log.Errorf("failed to create label: %v", err) } - }, } diff --git a/cmd/harbor/root/labels/delete.go b/cmd/harbor/root/labels/delete.go index 62d20d99..c6da1437 100644 --- a/cmd/harbor/root/labels/delete.go +++ b/cmd/harbor/root/labels/delete.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package labels import ( diff --git a/cmd/harbor/root/labels/list.go b/cmd/harbor/root/labels/list.go index 84f127bb..97687cf1 100644 --- a/cmd/harbor/root/labels/list.go +++ b/cmd/harbor/root/labels/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package labels import ( diff --git a/cmd/harbor/root/labels/update.go b/cmd/harbor/root/labels/update.go index 5eab1e68..983a576f 100644 --- a/cmd/harbor/root/labels/update.go +++ b/cmd/harbor/root/labels/update.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package labels import ( diff --git a/cmd/harbor/root/login.go b/cmd/harbor/root/login.go index 78750fbe..6926d47e 100644 --- a/cmd/harbor/root/login.go +++ b/cmd/harbor/root/login.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package root import ( diff --git a/cmd/harbor/root/project/cmd.go b/cmd/harbor/root/project/cmd.go index 39320601..b9987cca 100644 --- a/cmd/harbor/root/project/cmd.go +++ b/cmd/harbor/root/project/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( diff --git a/cmd/harbor/root/project/create.go b/cmd/harbor/root/project/create.go index 9366e518..6964f0a3 100644 --- a/cmd/harbor/root/project/create.go +++ b/cmd/harbor/root/project/create.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( @@ -34,7 +47,6 @@ func CreateProjectCommand() *cobra.Command { if err != nil { log.Errorf("failed to create project: %v", err) } - }, } @@ -60,5 +72,4 @@ func createProjectView(createView *create.CreateView) error { create.CreateProjectView(createView) return api.CreateProject(*createView) - } diff --git a/cmd/harbor/root/project/delete.go b/cmd/harbor/root/project/delete.go index 3e0e5b98..be7158cb 100644 --- a/cmd/harbor/root/project/delete.go +++ b/cmd/harbor/root/project/delete.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( diff --git a/cmd/harbor/root/project/list.go b/cmd/harbor/root/project/list.go index 9fae2bf4..aa0e88a8 100644 --- a/cmd/harbor/root/project/list.go +++ b/cmd/harbor/root/project/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( diff --git a/cmd/harbor/root/project/logs.go b/cmd/harbor/root/project/logs.go index 7b6787a3..5b0afb3e 100644 --- a/cmd/harbor/root/project/logs.go +++ b/cmd/harbor/root/project/logs.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( diff --git a/cmd/harbor/root/project/search.go b/cmd/harbor/root/project/search.go index 0e1ce12a..717a37c3 100644 --- a/cmd/harbor/root/project/search.go +++ b/cmd/harbor/root/project/search.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( @@ -15,7 +28,6 @@ func SearchProjectCommand() *cobra.Command { Short: "search project based on their names", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - projects, err := api.SearchProject(args[0]) if err != nil { log.Fatalf("failed to get projects: %v", err) @@ -30,7 +42,6 @@ func SearchProjectCommand() *cobra.Command { } else { list.SearchProjects(projects.Payload.Project) } - }, } return cmd diff --git a/cmd/harbor/root/project/view.go b/cmd/harbor/root/project/view.go index 8b92ce35..20424b20 100644 --- a/cmd/harbor/root/project/view.go +++ b/cmd/harbor/root/project/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( diff --git a/cmd/harbor/root/registry/cmd.go b/cmd/harbor/root/registry/cmd.go index 3f9d2e26..e7158d79 100644 --- a/cmd/harbor/root/registry/cmd.go +++ b/cmd/harbor/root/registry/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( diff --git a/cmd/harbor/root/registry/create.go b/cmd/harbor/root/registry/create.go index bf4d93ac..80f0f081 100644 --- a/cmd/harbor/root/registry/create.go +++ b/cmd/harbor/root/registry/create.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( diff --git a/cmd/harbor/root/registry/delete.go b/cmd/harbor/root/registry/delete.go index 7fbcfe1c..cfd35881 100644 --- a/cmd/harbor/root/registry/delete.go +++ b/cmd/harbor/root/registry/delete.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( @@ -8,7 +21,6 @@ import ( ) func DeleteRegistryCommand() *cobra.Command { - cmd := &cobra.Command{ Use: "delete", Short: "delete registry", diff --git a/cmd/harbor/root/registry/list.go b/cmd/harbor/root/registry/list.go index c55036f6..c49b57fc 100644 --- a/cmd/harbor/root/registry/list.go +++ b/cmd/harbor/root/registry/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( diff --git a/cmd/harbor/root/registry/update.go b/cmd/harbor/root/registry/update.go index 5bff569b..54c641f2 100644 --- a/cmd/harbor/root/registry/update.go +++ b/cmd/harbor/root/registry/update.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( diff --git a/cmd/harbor/root/registry/view.go b/cmd/harbor/root/registry/view.go index f407877c..1c8b8e78 100644 --- a/cmd/harbor/root/registry/view.go +++ b/cmd/harbor/root/registry/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( diff --git a/cmd/harbor/root/replication/cmd.go b/cmd/harbor/root/replication/cmd.go index 4051f146..46e64234 100644 --- a/cmd/harbor/root/replication/cmd.go +++ b/cmd/harbor/root/replication/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package replication import ( diff --git a/cmd/harbor/root/repository/cmd.go b/cmd/harbor/root/repository/cmd.go index c9da6a63..d8ba2156 100644 --- a/cmd/harbor/root/repository/cmd.go +++ b/cmd/harbor/root/repository/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repository import "github.com/spf13/cobra" @@ -16,5 +29,4 @@ func Repository() *cobra.Command { ) return cmd - } diff --git a/cmd/harbor/root/repository/delete.go b/cmd/harbor/root/repository/delete.go index fdb3caeb..74cc17cd 100644 --- a/cmd/harbor/root/repository/delete.go +++ b/cmd/harbor/root/repository/delete.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repository import ( diff --git a/cmd/harbor/root/repository/list.go b/cmd/harbor/root/repository/list.go index 72a59f5d..d4259c6b 100644 --- a/cmd/harbor/root/repository/list.go +++ b/cmd/harbor/root/repository/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repository import ( diff --git a/cmd/harbor/root/repository/search.go b/cmd/harbor/root/repository/search.go index 3071a813..7a693cce 100644 --- a/cmd/harbor/root/repository/search.go +++ b/cmd/harbor/root/repository/search.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repository import ( @@ -15,7 +28,6 @@ func SearchRepoCmd() *cobra.Command { Short: "search repository based on their names", Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - repo, err := api.SearchRepository(args[0]) if err != nil { log.Fatalf("failed to get repositories: %v", err) @@ -31,7 +43,6 @@ func SearchRepoCmd() *cobra.Command { } else { search.SearchRepositories(repo.Payload.Repository) } - }, } return cmd diff --git a/cmd/harbor/root/repository/update.go b/cmd/harbor/root/repository/update.go index 50a4378d..e7e70c63 100644 --- a/cmd/harbor/root/repository/update.go +++ b/cmd/harbor/root/repository/update.go @@ -1 +1,14 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repository diff --git a/cmd/harbor/root/repository/view.go b/cmd/harbor/root/repository/view.go index 463387df..5d20a55d 100644 --- a/cmd/harbor/root/repository/view.go +++ b/cmd/harbor/root/repository/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package repository import ( @@ -46,7 +59,6 @@ func RepoViewCmd() *cobra.Command { } else { view.ViewRepository(repo.Payload) } - }, } diff --git a/cmd/harbor/root/schedule/cmd.go b/cmd/harbor/root/schedule/cmd.go index 8b2a98d1..b0e4bb97 100644 --- a/cmd/harbor/root/schedule/cmd.go +++ b/cmd/harbor/root/schedule/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package schedule import ( diff --git a/cmd/harbor/root/schedule/list.go b/cmd/harbor/root/schedule/list.go index 88895fd2..ff0b5719 100644 --- a/cmd/harbor/root/schedule/list.go +++ b/cmd/harbor/root/schedule/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package schedule import ( diff --git a/cmd/harbor/root/user/cmd.go b/cmd/harbor/root/user/cmd.go index a68adf02..45287d78 100644 --- a/cmd/harbor/root/user/cmd.go +++ b/cmd/harbor/root/user/cmd.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package user import ( diff --git a/cmd/harbor/root/user/create.go b/cmd/harbor/root/user/create.go index 6b873cad..931997b7 100644 --- a/cmd/harbor/root/user/create.go +++ b/cmd/harbor/root/user/create.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package user import ( @@ -34,7 +47,6 @@ func UserCreateCmd() *cobra.Command { if err != nil { log.Errorf("failed to create user: %v", err) } - }, } @@ -51,5 +63,4 @@ func UserCreateCmd() *cobra.Command { func createUserView(createView *create.CreateView) error { create.CreateUserView(createView) return api.CreateUser(*createView) - } diff --git a/cmd/harbor/root/user/delete.go b/cmd/harbor/root/user/delete.go index 43c24528..390da307 100644 --- a/cmd/harbor/root/user/delete.go +++ b/cmd/harbor/root/user/delete.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package user import ( @@ -17,7 +30,6 @@ func UserDeleteCmd() *cobra.Command { if len(args) > 0 { userName, _ := api.GetUsersIdByName(args[0]) err = api.DeleteUser(userName) - } else { userId := prompt.GetUserIdFromUser() err = api.DeleteUser(userId) @@ -26,10 +38,8 @@ func UserDeleteCmd() *cobra.Command { if err != nil { log.Errorf("failed to delete user: %v", err) } - }, } return cmd - } diff --git a/cmd/harbor/root/user/elevate.go b/cmd/harbor/root/user/elevate.go index 66a38567..267e793e 100644 --- a/cmd/harbor/root/user/elevate.go +++ b/cmd/harbor/root/user/elevate.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package user import ( @@ -19,7 +32,6 @@ func ElevateUserCmd() *cobra.Command { var userId int64 if len(args) > 0 { userId, _ = api.GetUsersIdByName(args[0]) - } else { userId = prompt.GetUserIdFromUser() } @@ -33,7 +45,6 @@ func ElevateUserCmd() *cobra.Command { if err != nil { log.Errorf("failed to elevate user: %v", err) } - }, } diff --git a/cmd/harbor/root/user/list.go b/cmd/harbor/root/user/list.go index 810ccb58..b30bae07 100644 --- a/cmd/harbor/root/user/list.go +++ b/cmd/harbor/root/user/list.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package user import ( diff --git a/cmd/harbor/root/version.go b/cmd/harbor/root/version.go index 1daea6bd..0788c623 100644 --- a/cmd/harbor/root/version.go +++ b/cmd/harbor/root/version.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package root import ( @@ -9,7 +22,6 @@ import ( // versionCommand represents the version command func versionCommand() *cobra.Command { - cmd := &cobra.Command{ Use: "version", Short: "Version of Harbor CLI", diff --git a/copyright.tmpl b/copyright.tmpl new file mode 100644 index 00000000..749f14ba --- /dev/null +++ b/copyright.tmpl @@ -0,0 +1,13 @@ +Copyright Project Harbor Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/dagger/main.go b/dagger/main.go index b97d9b38..1abad37d 100644 --- a/dagger/main.go +++ b/dagger/main.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main import ( @@ -54,13 +67,14 @@ func (m *HarborCli) BuildDev( gitCommit, _ := builder.WithExec([]string{"git", "rev-parse", "--short", "HEAD"}).Stdout(ctx) buildTime := time.Now().UTC().Format(time.RFC3339) - ldflagsArgs := fmt.Sprintf(`-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=dev - -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GoVersion=%s - -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GitCommit=%s + ldflagsArgs := fmt.Sprintf(`-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=dev + -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GoVersion=%s + -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GitCommit=%s -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.BuildTime=%s `, GO_VERSION, buildTime, gitCommit) builder = builder.WithExec([]string{ - "go", "build", "-ldflags", ldflagsArgs, "-o", "bin/harbor-cli", "cmd/harbor/main.go"}) + "go", "build", "-ldflags", ldflagsArgs, "-o", "bin/harbor-cli", "cmd/harbor/main.go", + }) return builder.File("bin/harbor-cli") } @@ -96,14 +110,15 @@ func (m *HarborCli) build( gitCommit, _ := builder.WithExec([]string{"git", "rev-parse", "--short", "HEAD"}).Stdout(ctx) buildTime := time.Now().UTC().Format(time.RFC3339) - ldflagsArgs := fmt.Sprintf(`-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=%s - -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GoVersion=%s - -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GitCommit=%s + ldflagsArgs := fmt.Sprintf(`-X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.Version=%s + -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GoVersion=%s + -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.GitCommit=%s -X github.com/goharbor/harbor-cli/cmd/harbor/internal/version.BuildTime=%s `, version, GO_VERSION, buildTime, gitCommit) builder = builder.WithExec([]string{ - "go", "build", "-ldflags", ldflagsArgs, "-o", "bin/harbor-cli", "cmd/harbor/main.go"}). + "go", "build", "-ldflags", ldflagsArgs, "-o", "bin/harbor-cli", "cmd/harbor/main.go", + }). WithWorkdir(bin_path). WithExec([]string{"ls"}). WithEntrypoint([]string{"./harbor"}) @@ -113,13 +128,13 @@ func (m *HarborCli) build( return builds } -// LintReport Executes the Linter and writes the linting results to a file golangci-lint-report.sarif +// Executes Linter and writes results to a file golangci-lint.report func (m *HarborCli) LintReport(ctx context.Context) *dagger.File { - report := "golangci-lint-report.sarif" + report := "golangci-lint.report" return m.lint(ctx).WithExec([]string{ - "golangci-lint", "run", - "--out-format", "sarif:" + report, - "--issues-exit-code", "1", + "golangci-lint", "run", "-v", + "--out-format", "github-actions:" + report, + "--issues-exit-code", "0", }).File(report) } @@ -240,12 +255,12 @@ func (m *HarborCli) RunDoc(ctx context.Context) *dagger.Directory { WithEnvVariable("GOCACHE", "/go/build-cache"). WithMountedDirectory("/src", m.Source). WithWorkdir("/src/doc"). - WithExec([]string{"go", "run", "_doc.go"}). - WithExec([]string{"go", "run", "_man_doc.go"}). + WithExec([]string{"go", "run", "doc.go"}). + WithExec([]string{"go", "run", "./man-docs/man_doc.go"}). WithWorkdir("/src").Directory("/src/doc") } -// Test Executes Go tests and returns the directory containing the test results +// Executes Go tests func (m *HarborCli) Test(ctx context.Context) (string, error) { test := dag.Container(). From("golang:"+GO_VERSION+"-alpine"). @@ -259,6 +274,23 @@ func (m *HarborCli) Test(ctx context.Context) (string, error) { return test.Stdout(ctx) } +// Executes Go tests and returns TestReport in json file +func (m *HarborCli) TestReport(ctx context.Context) *dagger.File { + reportName := "TestReport.json" + test := dag.Container(). + From("golang:"+GO_VERSION+"-alpine"). + WithMountedCache("/go/pkg/mod", dag.CacheVolume("go-mod-"+GO_VERSION)). + WithEnvVariable("GOMODCACHE", "/go/pkg/mod"). + WithMountedCache("/go/build-cache", dag.CacheVolume("go-build-"+GO_VERSION)). + WithEnvVariable("GOCACHE", "/go/build-cache"). + WithExec([]string{"go", "install", "gotest.tools/gotestsum@latest"}). + WithMountedDirectory("/src", m.Source). + WithWorkdir("/src"). + WithExec([]string{"gotestsum", "--jsonfile", reportName}) + + return test.File(reportName) +} + // Parse the platform string into os and arch func parsePlatform(platform string) (string, string, error) { parts := strings.Split(platform, "/") diff --git a/doc/_doc.go b/doc/doc.go similarity index 86% rename from doc/_doc.go rename to doc/doc.go index 3f196208..0e356a68 100644 --- a/doc/_doc.go +++ b/doc/doc.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main import ( @@ -14,12 +27,14 @@ import ( "github.com/spf13/cobra" ) -const markdownExtension = ".md" -const frontmdtemplate = `--- +const ( + markdownExtension = ".md" + frontmdtemplate = `--- title: %s weight: %d --- ` +) func Doc() error { currentDir, err := os.Getwd() diff --git a/doc/_man_doc.go b/doc/man-docs/man_doc.go similarity index 59% rename from doc/_man_doc.go rename to doc/man-docs/man_doc.go index 228c439d..45cece12 100644 --- a/doc/_man_doc.go +++ b/doc/man-docs/man_doc.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package main import ( @@ -15,7 +28,7 @@ func ManDoc() error { if err != nil { return err } - folderName := "man-docs" + folderName := "man-docs/man1" _, err = os.Stat(folderName) if os.IsNotExist(err) { err = os.Mkdir(folderName, 0755) diff --git a/pkg/api/artifact_handler.go b/pkg/api/artifact_handler.go index d79eba44..c790d965 100644 --- a/pkg/api/artifact_handler.go +++ b/pkg/api/artifact_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( diff --git a/pkg/api/health_handler.go b/pkg/api/health_handler.go index ac21531b..ad094784 100644 --- a/pkg/api/health_handler.go +++ b/pkg/api/health_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( diff --git a/pkg/api/label_handler.go b/pkg/api/label_handler.go index 30f4e60e..55047f92 100644 --- a/pkg/api/label_handler.go +++ b/pkg/api/label_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( diff --git a/pkg/api/ping_handler.go b/pkg/api/ping_handler.go index e2005587..efc8cde2 100644 --- a/pkg/api/ping_handler.go +++ b/pkg/api/ping_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( diff --git a/pkg/api/project_handler.go b/pkg/api/project_handler.go index 9b19a468..76d0faf4 100644 --- a/pkg/api/project_handler.go +++ b/pkg/api/project_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( diff --git a/pkg/api/registry_handler.go b/pkg/api/registry_handler.go index 490fe08a..01ebc5dc 100644 --- a/pkg/api/registry_handler.go +++ b/pkg/api/registry_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( diff --git a/pkg/api/replication_handler.go b/pkg/api/replication_handler.go index 778f64ec..680f3c3a 100644 --- a/pkg/api/replication_handler.go +++ b/pkg/api/replication_handler.go @@ -1 +1,14 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api diff --git a/pkg/api/repository_handler.go b/pkg/api/repository_handler.go index 479fdd1f..a581c582 100644 --- a/pkg/api/repository_handler.go +++ b/pkg/api/repository_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( @@ -51,7 +64,6 @@ func ListRepository(projectName string) (repository.ListRepositoriesOK, error) { } return *response, nil - } func SearchRepository(query string) (search.SearchOK, error) { diff --git a/pkg/api/schedule_handler.go b/pkg/api/schedule_handler.go index b58fe1e9..94841d2a 100644 --- a/pkg/api/schedule_handler.go +++ b/pkg/api/schedule_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( @@ -26,5 +39,4 @@ func ListSchedule(opts ...ListFlags) (schedule.ListSchedulesOK, error) { } return *response, nil - } diff --git a/pkg/api/types.go b/pkg/api/types.go index 018a6f76..eb0b9321 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api type ListFlags struct { diff --git a/pkg/api/user_handler.go b/pkg/api/user_handler.go index b1e8a7d6..f0f99498 100644 --- a/pkg/api/user_handler.go +++ b/pkg/api/user_handler.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package api import ( @@ -24,7 +37,6 @@ func CreateUser(opts create.CreateView) error { Username: opts.Username, }, }) - if err != nil { return err } diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 1255fc8b..39557532 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -1 +1,14 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package constants diff --git a/pkg/prompt/prompt.go b/pkg/prompt/prompt.go index 5f46e952..10dfc217 100644 --- a/pkg/prompt/prompt.go +++ b/pkg/prompt/prompt.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package prompt import ( @@ -17,11 +30,9 @@ func GetRegistryNameFromUser() int64 { go func() { response, _ := api.ListRegistries() rview.RegistryList(response.Payload, registryId) - }() return <-registryId - } func GetProjectNameFromUser() string { @@ -29,7 +40,6 @@ func GetProjectNameFromUser() string { go func() { response, _ := api.ListAllProjects() pview.ProjectList(response.Payload, projectName) - }() return <-projectName @@ -39,7 +49,6 @@ func GetRepoNameFromUser(projectName string) string { repositoryName := make(chan string) go func() { - response, err := api.ListRepository(projectName) if err != nil { log.Fatal(err) @@ -69,7 +78,6 @@ func GetUserIdFromUser() int64 { }() return <-userId - } func GetTagFromUser(repoName, projectName, reference string) string { @@ -85,7 +93,6 @@ func GetTagNameFromUser() string { repoName := make(chan string) go func() { - }() return <-repoName diff --git a/pkg/utils/client.go b/pkg/utils/client.go index 388e380a..81c59772 100644 --- a/pkg/utils/client.go +++ b/pkg/utils/client.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package utils import ( diff --git a/pkg/utils/config.go b/pkg/utils/config.go index ec83542c..66c0921e 100644 --- a/pkg/utils/config.go +++ b/pkg/utils/config.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package utils import ( diff --git a/pkg/utils/error.go b/pkg/utils/error.go index d4b585bf..df040916 100644 --- a/pkg/utils/error.go +++ b/pkg/utils/error.go @@ -1 +1,14 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package utils diff --git a/pkg/utils/helper.go b/pkg/utils/helper.go index ba11029e..05a8f3c7 100644 --- a/pkg/utils/helper.go +++ b/pkg/utils/helper.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package utils import ( diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 5bff7837..bc027c71 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package utils import ( diff --git a/pkg/views/artifact/list/view.go b/pkg/views/artifact/list/view.go index 62901de7..7a8023fa 100644 --- a/pkg/views/artifact/list/view.go +++ b/pkg/views/artifact/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( diff --git a/pkg/views/artifact/select/view.go b/pkg/views/artifact/select/view.go index 1c488baf..5dd44032 100644 --- a/pkg/views/artifact/select/view.go +++ b/pkg/views/artifact/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( @@ -20,7 +33,6 @@ func ListArtifacts(artifacts []*models.Artifact, choice chan<- string) { m := selection.NewModel(itemsList, "Artifact") p, err := tea.NewProgram(m, tea.WithAltScreen()).Run() - if err != nil { fmt.Println("Error running program:", err) os.Exit(1) @@ -29,5 +41,4 @@ func ListArtifacts(artifacts []*models.Artifact, choice chan<- string) { if p, ok := p.(selection.Model); ok { choice <- p.Choice } - } diff --git a/pkg/views/artifact/tags/create/view.go b/pkg/views/artifact/tags/create/view.go index 011024df..b0933236 100644 --- a/pkg/views/artifact/tags/create/view.go +++ b/pkg/views/artifact/tags/create/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package create import ( diff --git a/pkg/views/artifact/tags/list/view.go b/pkg/views/artifact/tags/list/view.go index f20491b5..36d46d7c 100644 --- a/pkg/views/artifact/tags/list/view.go +++ b/pkg/views/artifact/tags/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( @@ -20,7 +33,6 @@ var columns = []table.Column{ func ListTags(tags []*models.Tag) { var rows []table.Row for _, tag := range tags { - pullTime, _ := utils.FormatCreatedTime(tag.PullTime.String()) pushTime, _ := utils.FormatCreatedTime(tag.PushTime.String()) rows = append(rows, table.Row{ diff --git a/pkg/views/artifact/tags/select/view.go b/pkg/views/artifact/tags/select/view.go index c20bedeb..75008134 100644 --- a/pkg/views/artifact/tags/select/view.go +++ b/pkg/views/artifact/tags/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( @@ -29,5 +42,4 @@ func ListTags(tag []*models.Tag, choice chan<- string) { if p, ok := p.(selection.Model); ok { choice <- p.Choice } - } diff --git a/pkg/views/artifact/view/view.go b/pkg/views/artifact/view/view.go index 13288d17..b04a7e3b 100644 --- a/pkg/views/artifact/view/view.go +++ b/pkg/views/artifact/view/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package view import ( diff --git a/pkg/views/base/selection/model.go b/pkg/views/base/selection/model.go index 214fbba5..039ca857 100644 --- a/pkg/views/base/selection/model.go +++ b/pkg/views/base/selection/model.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package selection import ( diff --git a/pkg/views/base/tablelist/model.go b/pkg/views/base/tablelist/model.go index 9dc4b48e..e1a658f3 100644 --- a/pkg/views/base/tablelist/model.go +++ b/pkg/views/base/tablelist/model.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package tablelist import ( diff --git a/pkg/views/confirmation.go b/pkg/views/confirmation.go index 8bbf7067..a8348dc6 100644 --- a/pkg/views/confirmation.go +++ b/pkg/views/confirmation.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package views import ( diff --git a/pkg/views/health/view.go b/pkg/views/health/view.go index e94460b3..1e854c12 100644 --- a/pkg/views/health/view.go +++ b/pkg/views/health/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package health import ( diff --git a/pkg/views/label/create/view.go b/pkg/views/label/create/view.go index fba21e12..2d0f7ed1 100644 --- a/pkg/views/label/create/view.go +++ b/pkg/views/label/create/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package create import ( diff --git a/pkg/views/label/list/view.go b/pkg/views/label/list/view.go index 169eee6b..1bb51402 100644 --- a/pkg/views/label/list/view.go +++ b/pkg/views/label/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( diff --git a/pkg/views/label/select/view.go b/pkg/views/label/select/view.go index f511b694..a2859de1 100644 --- a/pkg/views/label/select/view.go +++ b/pkg/views/label/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package delete import ( @@ -32,5 +45,4 @@ func LabelList(label []*models.Label, choice chan<- int64) { if p, ok := p.(selection.Model); ok { choice <- items[p.Choice] } - } diff --git a/pkg/views/label/update/view.go b/pkg/views/label/update/view.go index 63bc3503..cf62d939 100644 --- a/pkg/views/label/update/view.go +++ b/pkg/views/label/update/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package update import ( diff --git a/pkg/views/login/create.go b/pkg/views/login/create.go index ad653521..f5109e1e 100644 --- a/pkg/views/login/create.go +++ b/pkg/views/login/create.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package login import ( diff --git a/pkg/views/project/create/view.go b/pkg/views/project/create/view.go index 89ea0c79..64cb7dfc 100644 --- a/pkg/views/project/create/view.go +++ b/pkg/views/project/create/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package create import ( diff --git a/pkg/views/project/list/view.go b/pkg/views/project/list/view.go index f91594bf..7723bb03 100644 --- a/pkg/views/project/list/view.go +++ b/pkg/views/project/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( diff --git a/pkg/views/project/logs/view.go b/pkg/views/project/logs/view.go index 51945d88..4f900dec 100644 --- a/pkg/views/project/logs/view.go +++ b/pkg/views/project/logs/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( @@ -14,7 +27,7 @@ import ( var columns = []table.Column{ {Title: "Username", Width: 12}, {Title: "Resource", Width: 24}, - {Title: "Resouce Type", Width: 12}, + {Title: "Resource Type", Width: 12}, {Title: "Operation", Width: 12}, {Title: "Timestamp", Width: 30}, } @@ -22,7 +35,6 @@ var columns = []table.Column{ func LogsProject(logs []*models.AuditLog) { var rows []table.Row for _, log := range logs { - createTime, _ := utils.FormatCreatedTime(log.OpTime.String()) rows = append(rows, table.Row{ log.Username, @@ -38,5 +50,4 @@ func LogsProject(logs []*models.AuditLog) { fmt.Println("Error running program:", err) os.Exit(1) } - } diff --git a/pkg/views/project/select/view.go b/pkg/views/project/select/view.go index a3fad35c..00053425 100644 --- a/pkg/views/project/select/view.go +++ b/pkg/views/project/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( @@ -28,5 +41,4 @@ func ProjectList(project []*models.Project, choice chan<- string) { if p, ok := p.(selection.Model); ok { choice <- p.Choice } - } diff --git a/pkg/views/project/view/view.go b/pkg/views/project/view/view.go index 66e2b937..17341f8a 100644 --- a/pkg/views/project/view/view.go +++ b/pkg/views/project/view/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package view import ( diff --git a/pkg/views/registry/create/view.go b/pkg/views/registry/create/view.go index ff090ec5..979688c6 100644 --- a/pkg/views/registry/create/view.go +++ b/pkg/views/registry/create/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package create import ( diff --git a/pkg/views/registry/list/view.go b/pkg/views/registry/list/view.go index 1884c58c..9a1a4750 100644 --- a/pkg/views/registry/list/view.go +++ b/pkg/views/registry/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( diff --git a/pkg/views/registry/select/view.go b/pkg/views/registry/select/view.go index 42734b22..fe9f1e22 100644 --- a/pkg/views/registry/select/view.go +++ b/pkg/views/registry/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package registry import ( diff --git a/pkg/views/registry/update/view.go b/pkg/views/registry/update/view.go index c073c400..c1a6d306 100644 --- a/pkg/views/registry/update/view.go +++ b/pkg/views/registry/update/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package update import ( diff --git a/pkg/views/registry/view/view.go b/pkg/views/registry/view/view.go index f792b930..a77f035f 100644 --- a/pkg/views/registry/view/view.go +++ b/pkg/views/registry/view/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package view import ( diff --git a/pkg/views/repository/list/view.go b/pkg/views/repository/list/view.go index 9d5b17fc..9f12a998 100644 --- a/pkg/views/repository/list/view.go +++ b/pkg/views/repository/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( @@ -22,7 +35,6 @@ var columns = []table.Column{ func ListRepositories(repos []*models.Repository) { var rows []table.Row for _, repo := range repos { - createdTime, _ := utils.FormatCreatedTime(repo.UpdateTime.String()) rows = append(rows, table.Row{ repo.Name, diff --git a/pkg/views/repository/search/view.go b/pkg/views/repository/search/view.go index 508adcf5..56e40d9a 100644 --- a/pkg/views/repository/search/view.go +++ b/pkg/views/repository/search/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package search import ( diff --git a/pkg/views/repository/select/view.go b/pkg/views/repository/select/view.go index da30963b..35d5fbdc 100644 --- a/pkg/views/repository/select/view.go +++ b/pkg/views/repository/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package project import ( @@ -31,5 +44,4 @@ func RepositoryList(repos []*models.Repository, choice chan<- string) { if p, ok := p.(selection.Model); ok { choice <- p.Choice } - } diff --git a/pkg/views/repository/view/view.go b/pkg/views/repository/view/view.go index 0b5944b5..e1605ffd 100644 --- a/pkg/views/repository/view/view.go +++ b/pkg/views/repository/view/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package view import ( diff --git a/pkg/views/schedule/list/view.go b/pkg/views/schedule/list/view.go index ffb55122..bdcec5a9 100644 --- a/pkg/views/schedule/list/view.go +++ b/pkg/views/schedule/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( diff --git a/pkg/views/styles.go b/pkg/views/styles.go index b00c92be..1f0ab7b5 100644 --- a/pkg/views/styles.go +++ b/pkg/views/styles.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package views import ( diff --git a/pkg/views/user/create/view.go b/pkg/views/user/create/view.go index e52b3498..f8a1cbfc 100644 --- a/pkg/views/user/create/view.go +++ b/pkg/views/user/create/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package create import ( diff --git a/pkg/views/user/list/view.go b/pkg/views/user/list/view.go index b036a24d..19987cb1 100644 --- a/pkg/views/user/list/view.go +++ b/pkg/views/user/list/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package list import ( diff --git a/pkg/views/user/select/view.go b/pkg/views/user/select/view.go index 722a63da..76a05880 100644 --- a/pkg/views/user/select/view.go +++ b/pkg/views/user/select/view.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package user import ( @@ -32,5 +45,4 @@ func UserList(users []*models.UserResp, choice chan<- int64) { if p, ok := p.(selection.Model); ok { choice <- items[p.Choice] } - } diff --git a/test/e2e/config_test.go b/test/e2e/config_test.go index 239491c5..d70b0567 100644 --- a/test/e2e/config_test.go +++ b/test/e2e/config_test.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package e2e import ( diff --git a/test/e2e/login_test.go b/test/e2e/login_test.go index e3869057..4504f534 100644 --- a/test/e2e/login_test.go +++ b/test/e2e/login_test.go @@ -1,3 +1,16 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. package e2e import (