mirror of
https://github.com/project-zot/zot.git
synced 2024-12-16 21:56:37 -05:00
build: migrate to golang 1.23.x (#2701)
* build: migrate to golang 1.23.x Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> * fix: golangci-lint reported errors Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com> --------- Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
parent
a76bfd4283
commit
5465aa0d51
33 changed files with 75 additions and 75 deletions
2
.github/workflows/benchmark.yaml
vendored
2
.github/workflows/benchmark.yaml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
# Run benchmark with `go test -bench` and stores the output to a file
|
# Run benchmark with `go test -bench` and stores the output to a file
|
||||||
- name: Run benchmark
|
- name: Run benchmark
|
||||||
run: make BENCH_OUTPUT=ci-cd run-bench
|
run: make BENCH_OUTPUT=ci-cd run-bench
|
||||||
|
|
2
.github/workflows/branch-cov.yaml
vendored
2
.github/workflows/branch-cov.yaml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
|
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
|
@ -30,7 +30,7 @@ jobs:
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Cache go dependencies
|
- name: Cache go dependencies
|
||||||
id: cache-go-dependencies
|
id: cache-go-dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
|
2
.github/workflows/cloc.yaml
vendored
2
.github/workflows/cloc.yaml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Check out source code
|
- name: Check out source code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
|
2
.github/workflows/cluster.yaml
vendored
2
.github/workflows/cluster.yaml
vendored
|
@ -31,7 +31,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
|
@ -49,7 +49,7 @@ jobs:
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
|
|
2
.github/workflows/compare-binary-size.yaml
vendored
2
.github/workflows/compare-binary-size.yaml
vendored
|
@ -14,7 +14,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Checkout zot (main branch)
|
- name: Checkout zot (main branch)
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $GITHUB_WORKSPACE/zot_main
|
mkdir -p $GITHUB_WORKSPACE/zot_main
|
||||||
|
|
2
.github/workflows/ecosystem-tools.yaml
vendored
2
.github/workflows/ecosystem-tools.yaml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
|
8
.github/workflows/gc-stress-test.yaml
vendored
8
.github/workflows/gc-stress-test.yaml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
|
|
||||||
- name: Run zb
|
- name: Run zb
|
||||||
id: bench
|
id: bench
|
||||||
|
@ -51,7 +51,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
|
|
||||||
- name: Run zb
|
- name: Run zb
|
||||||
id: bench
|
id: bench
|
||||||
|
@ -82,7 +82,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- uses: ./.github/actions/setup-localstack
|
- uses: ./.github/actions/setup-localstack
|
||||||
- name: Setup minio service
|
- name: Setup minio service
|
||||||
run: |
|
run: |
|
||||||
|
@ -157,7 +157,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- uses: ./.github/actions/setup-localstack
|
- uses: ./.github/actions/setup-localstack
|
||||||
- name: Setup minio service
|
- name: Setup minio service
|
||||||
run: |
|
run: |
|
||||||
|
|
4
.github/workflows/golangci-lint.yaml
vendored
4
.github/workflows/golangci-lint.yaml
vendored
|
@ -18,13 +18,13 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: '1.22'
|
go-version: '1.23'
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Run linter with GH action
|
- name: Run linter with GH action
|
||||||
uses: golangci/golangci-lint-action@v6
|
uses: golangci/golangci-lint-action@v6
|
||||||
with:
|
with:
|
||||||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||||
version: v1.59.1
|
version: v1.61.0
|
||||||
|
|
||||||
# Optional: working directory, useful for monorepos
|
# Optional: working directory, useful for monorepos
|
||||||
# working-directory: somedir
|
# working-directory: somedir
|
||||||
|
|
2
.github/workflows/gqlgen.yaml
vendored
2
.github/workflows/gqlgen.yaml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
|
2
.github/workflows/license.yaml
vendored
2
.github/workflows/license.yaml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install go-licenses
|
- name: Install go-licenses
|
||||||
run: go install github.com/google/go-licenses@latest
|
run: go install github.com/google/go-licenses@latest
|
||||||
- name: Check for forbidden licenses
|
- name: Check for forbidden licenses
|
||||||
|
|
12
.github/workflows/nightly.yaml
vendored
12
.github/workflows/nightly.yaml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
@ -72,7 +72,7 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
@ -90,7 +90,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- uses: ./.github/actions/setup-localstack
|
- uses: ./.github/actions/setup-localstack
|
||||||
|
|
||||||
- name: Run zb
|
- name: Run zb
|
||||||
|
@ -127,7 +127,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- uses: ./.github/actions/setup-localstack
|
- uses: ./.github/actions/setup-localstack
|
||||||
|
|
||||||
- name: Run zb
|
- name: Run zb
|
||||||
|
@ -175,7 +175,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
@ -206,7 +206,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
|
|
@ -20,11 +20,11 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Steps represent a sequence of tasks that will be executed as part of the job
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
steps:
|
steps:
|
||||||
- name: Install go 1.22
|
- name: Install go 1.23
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Checkout this PR
|
- name: Checkout this PR
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Start zot server
|
- name: Start zot server
|
||||||
|
|
2
.github/workflows/sync-3rdparty-images.yaml
vendored
2
.github/workflows/sync-3rdparty-images.yaml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
golang_version:
|
golang_version:
|
||||||
- "1.22"
|
- "1.23"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Log in to GitHub Docker Registry
|
- name: Log in to GitHub Docker Registry
|
||||||
|
|
8
.github/workflows/test.yaml
vendored
8
.github/workflows/test.yaml
vendored
|
@ -21,7 +21,7 @@ jobs:
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Cache go dependencies
|
- name: Cache go dependencies
|
||||||
id: cache-go-dependencies
|
id: cache-go-dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
@ -60,7 +60,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Cache go dependencies
|
- name: Cache go dependencies
|
||||||
id: cache-go-dependencies
|
id: cache-go-dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
@ -99,7 +99,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Cache go dependencies
|
- name: Cache go dependencies
|
||||||
id: cache-go-dependencies
|
id: cache-go-dependencies
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
@ -133,7 +133,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: download all workflow coverage files
|
- name: download all workflow coverage files
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
- name: merge code coverage
|
- name: merge code coverage
|
||||||
|
|
2
.github/workflows/tls.yaml
vendored
2
.github/workflows/tls.yaml
vendored
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- uses: actions/setup-go@v5
|
- uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
|
|
2
.github/workflows/web-scan.yaml
vendored
2
.github/workflows/web-scan.yaml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
go-version: 1.22.x
|
go-version: 1.23.x
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Build zot
|
- name: Build zot
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -10,7 +10,7 @@ TOOLSDIR := $(shell pwd)/hack/tools
|
||||||
PATH := bin:$(TOOLSDIR)/bin:$(PATH)
|
PATH := bin:$(TOOLSDIR)/bin:$(PATH)
|
||||||
STACKER := $(shell which stacker)
|
STACKER := $(shell which stacker)
|
||||||
GOLINTER := $(TOOLSDIR)/bin/golangci-lint
|
GOLINTER := $(TOOLSDIR)/bin/golangci-lint
|
||||||
GOLINTER_VERSION := v1.59.1
|
GOLINTER_VERSION := v1.61.0
|
||||||
NOTATION := $(TOOLSDIR)/bin/notation
|
NOTATION := $(TOOLSDIR)/bin/notation
|
||||||
NOTATION_VERSION := 1.0.0
|
NOTATION_VERSION := 1.0.0
|
||||||
COSIGN := $(TOOLSDIR)/bin/cosign
|
COSIGN := $(TOOLSDIR)/bin/cosign
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,6 +1,6 @@
|
||||||
module zotregistry.dev/zot
|
module zotregistry.dev/zot
|
||||||
|
|
||||||
go 1.22.8
|
go 1.23.2
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/99designs/gqlgen v0.17.55
|
github.com/99designs/gqlgen v0.17.55
|
||||||
|
|
|
@ -78,7 +78,7 @@ func NewController(appConfig *config.Config) *Controller {
|
||||||
panic("failed to get member socket")
|
panic("failed to get member socket")
|
||||||
}
|
}
|
||||||
|
|
||||||
if memberSocket == "" {
|
if memberSocketIdx < 0 || memberSocket == "" {
|
||||||
// there is a misconfiguration if the memberSocket cannot be identified
|
// there is a misconfiguration if the memberSocket cannot be identified
|
||||||
logger.Error().
|
logger.Error().
|
||||||
Str("members", strings.Join(appConfig.Cluster.Members, ",")).
|
Str("members", strings.Join(appConfig.Cluster.Members, ",")).
|
||||||
|
|
|
@ -381,7 +381,7 @@ func TestAutoPortSelection(t *testing.T) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Logf(scanner.Text())
|
t.Logf("%s", scanner.Text())
|
||||||
}
|
}
|
||||||
|
|
||||||
So(scanner.Err(), ShouldBeNil)
|
So(scanner.Err(), ShouldBeNil)
|
||||||
|
|
|
@ -61,7 +61,7 @@ func (lc *LDAPClient) Connect() error {
|
||||||
RootCAs: lc.ClientCAs,
|
RootCAs: lc.ClientCAs,
|
||||||
}
|
}
|
||||||
|
|
||||||
if lc.ClientCertificates != nil && len(lc.ClientCertificates) > 0 {
|
if len(lc.ClientCertificates) > 0 {
|
||||||
config.Certificates = lc.ClientCertificates
|
config.Certificates = lc.ClientCertificates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func (lc *LDAPClient) Connect() error {
|
||||||
ServerName: lc.ServerName,
|
ServerName: lc.ServerName,
|
||||||
RootCAs: lc.ClientCAs,
|
RootCAs: lc.ClientCAs,
|
||||||
}
|
}
|
||||||
if lc.ClientCertificates != nil && len(lc.ClientCertificates) > 0 {
|
if len(lc.ClientCertificates) > 0 {
|
||||||
config.Certificates = lc.ClientCertificates
|
config.Certificates = lc.ClientCertificates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -962,7 +962,7 @@ func (ref referrersResult) stringPlainText(maxArtifactTypeLen int) (string, erro
|
||||||
for _, referrer := range ref {
|
for _, referrer := range ref {
|
||||||
artifactType := ellipsize(referrer.ArtifactType, maxArtifactTypeLen, ellipsis)
|
artifactType := ellipsize(referrer.ArtifactType, maxArtifactTypeLen, ellipsis)
|
||||||
// digest := ellipsize(godigest.Digest(referrer.Digest).Encoded(), digestWidth, "")
|
// digest := ellipsize(godigest.Digest(referrer.Digest).Encoded(), digestWidth, "")
|
||||||
size := ellipsize(humanize.Bytes(uint64(referrer.Size)), sizeWidth, ellipsis)
|
size := ellipsize(humanize.Bytes(uint64(referrer.Size)), sizeWidth, ellipsis) //nolint:gosec,lll // refererrer.Size should >= 0
|
||||||
|
|
||||||
row := make([]string, refRowWidth)
|
row := make([]string, refRowWidth)
|
||||||
row[refArtifactTypeIndex] = artifactType
|
row[refArtifactTypeIndex] = artifactType
|
||||||
|
@ -1042,7 +1042,7 @@ func (repo repoStruct) stringPlainText(repoMaxLen, maxTimeLen int, verbose bool)
|
||||||
|
|
||||||
row := make([]string, repoRowWidth)
|
row := make([]string, repoRowWidth)
|
||||||
row[repoNameIndex] = repoName
|
row[repoNameIndex] = repoName
|
||||||
row[repoSizeIndex] = ellipsize(strings.ReplaceAll(humanize.Bytes(uint64(repoSize)), " ", ""), sizeWidth, ellipsis)
|
row[repoSizeIndex] = ellipsize(strings.ReplaceAll(humanize.Bytes(uint64(repoSize)), " ", ""), sizeWidth, ellipsis) //nolint:gosec,lll // ignore overflow
|
||||||
row[repoLastUpdatedIndex] = repoLastUpdated.String()
|
row[repoLastUpdatedIndex] = repoLastUpdated.String()
|
||||||
row[repoDownloadsIndex] = strconv.Itoa(repoDownloads)
|
row[repoDownloadsIndex] = strconv.Itoa(repoDownloads)
|
||||||
row[repoStarsIndex] = strconv.Itoa(repoStars)
|
row[repoStarsIndex] = strconv.Itoa(repoStars)
|
||||||
|
@ -1335,15 +1335,15 @@ func combineServerAndEndpointURL(serverURL, endPoint string) (string, error) {
|
||||||
return newURL.String(), nil
|
return newURL.String(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ellipsize(text string, max int, trailing string) string {
|
func ellipsize(text string, maxLength int, trailing string) string {
|
||||||
text = strings.TrimSpace(text)
|
text = strings.TrimSpace(text)
|
||||||
if len(text) <= max {
|
if len(text) <= maxLength {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
||||||
chopLength := len(trailing)
|
chopLength := len(trailing)
|
||||||
|
|
||||||
return text[:max-chopLength] + trailing
|
return text[:maxLength-chopLength] + trailing
|
||||||
}
|
}
|
||||||
|
|
||||||
func getImageTableWriter(writer io.Writer) *tablewriter.Table {
|
func getImageTableWriter(writer io.Writer) *tablewriter.Table {
|
||||||
|
|
|
@ -118,7 +118,7 @@ func TestCommon(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Test AreSocketsEqual with equal IPv6 sockets", t, func() {
|
Convey("Test AreSocketsEqual with equal IPv6 sockets", t, func() {
|
||||||
result, err := common.AreSocketsEqual("[::1]:9000", "[0000:0000:0000:0000:0000:0000:0000:00001]:9000")
|
result, err := common.AreSocketsEqual("[::1]:9000", "[0000:0000:0000:0000:0000:0000:0000:0001]:9000")
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(result, ShouldBeTrue)
|
So(result, ShouldBeTrue)
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,8 +30,8 @@ import (
|
||||||
. "zotregistry.dev/zot/pkg/test/common"
|
. "zotregistry.dev/zot/pkg/test/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getRandomLatencyN(max int64) time.Duration {
|
func getRandomLatencyN(maxLatency int64) time.Duration {
|
||||||
nBig, err := rand.Int(rand.Reader, big.NewInt(max))
|
nBig, err := rand.Int(rand.Reader, big.NewInt(maxLatency))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4670,7 +4670,7 @@ func TestSignatures(t *testing.T) {
|
||||||
|
|
||||||
splittedURL := strings.SplitAfter(srcBaseURL, ":")
|
splittedURL := strings.SplitAfter(srcBaseURL, ":")
|
||||||
srcPort := splittedURL[len(splittedURL)-1]
|
srcPort := splittedURL[len(splittedURL)-1]
|
||||||
t.Logf(srcPort)
|
t.Logf("%s", srcPort)
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
|
||||||
|
@ -5201,7 +5201,7 @@ func TestSignatures(t *testing.T) {
|
||||||
|
|
||||||
splittedURL := strings.SplitAfter(srcBaseURL, ":")
|
splittedURL := strings.SplitAfter(srcBaseURL, ":")
|
||||||
srcPort := splittedURL[len(splittedURL)-1]
|
srcPort := splittedURL[len(splittedURL)-1]
|
||||||
t.Logf(srcPort)
|
t.Logf("%s", srcPort)
|
||||||
|
|
||||||
err := signature.SignImageUsingCosign(fmt.Sprintf("%s@%s", repoName, digest.String()), srcPort, true)
|
err := signature.SignImageUsingCosign(fmt.Sprintf("%s@%s", repoName, digest.String()), srcPort, true)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
|
|
@ -451,7 +451,7 @@ func (bdw *BoltDB) SearchRepos(ctx context.Context, searchText string,
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
protoRepoMeta.Rank = int32(rank)
|
protoRepoMeta.Rank = int32(rank) //nolint:gosec // ignore overflow
|
||||||
protoRepoMeta.IsStarred = zcommon.Contains(userStars, protoRepoMeta.Name)
|
protoRepoMeta.IsStarred = zcommon.Contains(userStars, protoRepoMeta.Name)
|
||||||
protoRepoMeta.IsBookmarked = zcommon.Contains(userBookmarks, protoRepoMeta.Name)
|
protoRepoMeta.IsBookmarked = zcommon.Contains(userBookmarks, protoRepoMeta.Name)
|
||||||
|
|
||||||
|
|
|
@ -647,7 +647,7 @@ func TestWrapperErrors(t *testing.T) {
|
||||||
|
|
||||||
Convey("DeleteUserData", func() {
|
Convey("DeleteUserData", func() {
|
||||||
userAc = reqCtx.NewUserAccessControl()
|
userAc = reqCtx.NewUserAccessControl()
|
||||||
ctx = userAc.DeriveContext(context.Background())
|
ctx = userAc.DeriveContext(context.Background()) //nolint:fatcontext // test code
|
||||||
|
|
||||||
err = boltdbWrapper.DeleteUserData(ctx)
|
err = boltdbWrapper.DeleteUserData(ctx)
|
||||||
So(err, ShouldNotBeNil)
|
So(err, ShouldNotBeNil)
|
||||||
|
@ -667,7 +667,7 @@ func TestWrapperErrors(t *testing.T) {
|
||||||
|
|
||||||
Convey("GetUserGroups and SetUserGroups", func() {
|
Convey("GetUserGroups and SetUserGroups", func() {
|
||||||
userAc = reqCtx.NewUserAccessControl()
|
userAc = reqCtx.NewUserAccessControl()
|
||||||
ctx = userAc.DeriveContext(context.Background())
|
ctx = userAc.DeriveContext(context.Background()) //nolint:fatcontext // test code
|
||||||
|
|
||||||
_, err := boltdbWrapper.GetUserGroups(ctx)
|
_, err := boltdbWrapper.GetUserGroups(ctx)
|
||||||
So(err, ShouldNotBeNil)
|
So(err, ShouldNotBeNil)
|
||||||
|
|
|
@ -23,8 +23,8 @@ func GetProtoRepoMeta(repo mTypes.RepoMeta) *proto_go.RepoMeta {
|
||||||
Vendors: repo.Vendors,
|
Vendors: repo.Vendors,
|
||||||
Platforms: GetProtoPlatforms(repo.Platforms),
|
Platforms: GetProtoPlatforms(repo.Platforms),
|
||||||
LastUpdatedImage: GetProtoLastUpdatedImage(repo.LastUpdatedImage),
|
LastUpdatedImage: GetProtoLastUpdatedImage(repo.LastUpdatedImage),
|
||||||
Stars: int32(repo.StarCount),
|
Stars: int32(repo.StarCount), //nolint:gosec // ignore overflow
|
||||||
Downloads: int32(repo.DownloadCount),
|
Downloads: int32(repo.DownloadCount), //nolint:gosec // ignore overflow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ func GetProtoManifestMeta(manifestContent ispec.Manifest, configContent ispec.Im
|
||||||
Digest: digest,
|
Digest: digest,
|
||||||
Size: size,
|
Size: size,
|
||||||
Manifest: &proto_go.Manifest{
|
Manifest: &proto_go.Manifest{
|
||||||
Versioned: &proto_go.Versioned{SchemaVersion: int32(manifestContent.SchemaVersion)},
|
Versioned: &proto_go.Versioned{SchemaVersion: int32(manifestContent.SchemaVersion)}, //nolint:gosec,lll // ignore overflow
|
||||||
Config: &proto_go.Descriptor{
|
Config: &proto_go.Descriptor{
|
||||||
Digest: manifestContent.Config.Digest.String(),
|
Digest: manifestContent.Config.Digest.String(),
|
||||||
Size: manifestContent.Config.Size,
|
Size: manifestContent.Config.Size,
|
||||||
|
@ -108,7 +108,7 @@ func GetProtoImageIndexMeta(indexContent ispec.Index, size int64, digest string)
|
||||||
Size: size,
|
Size: size,
|
||||||
Digest: digest,
|
Digest: digest,
|
||||||
Index: &proto_go.Index{
|
Index: &proto_go.Index{
|
||||||
Versioned: &proto_go.Versioned{SchemaVersion: int32(indexContent.Versioned.SchemaVersion)},
|
Versioned: &proto_go.Versioned{SchemaVersion: int32(indexContent.Versioned.SchemaVersion)}, //nolint:gosec,lll // ignore overflow
|
||||||
MediaType: ref(ispec.MediaTypeImageIndex),
|
MediaType: ref(ispec.MediaTypeImageIndex),
|
||||||
ArtifactType: ref(common.GetIndexArtifactType(indexContent)),
|
ArtifactType: ref(common.GetIndexArtifactType(indexContent)),
|
||||||
Manifests: getProtoManifestList(indexContent.Manifests),
|
Manifests: getProtoManifestList(indexContent.Manifests),
|
||||||
|
@ -125,7 +125,7 @@ func GetProtoStatistics(stats map[mTypes.ImageDigest]mTypes.DescriptorStatistics
|
||||||
|
|
||||||
for digest, stat := range stats {
|
for digest, stat := range stats {
|
||||||
results[digest] = &proto_go.DescriptorStatistics{
|
results[digest] = &proto_go.DescriptorStatistics{
|
||||||
DownloadCount: int32(stat.DownloadCount),
|
DownloadCount: int32(stat.DownloadCount), //nolint:gosec // ignore overflow
|
||||||
LastPullTimestamp: timestamppb.New(stat.LastPullTimestamp),
|
LastPullTimestamp: timestamppb.New(stat.LastPullTimestamp),
|
||||||
PushTimestamp: timestamppb.New(stat.PushTimestamp),
|
PushTimestamp: timestamppb.New(stat.PushTimestamp),
|
||||||
PushedBy: stat.PushedBy,
|
PushedBy: stat.PushedBy,
|
||||||
|
|
|
@ -613,7 +613,7 @@ func (dwr *DynamoDB) SearchRepos(ctx context.Context, searchText string) ([]mTyp
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
protoRepoMeta.Rank = int32(rank)
|
protoRepoMeta.Rank = int32(rank) //nolint:gosec // ignore overflow
|
||||||
protoRepoMeta.IsStarred = zcommon.Contains(userStars, protoRepoMeta.Name)
|
protoRepoMeta.IsStarred = zcommon.Contains(userStars, protoRepoMeta.Name)
|
||||||
protoRepoMeta.IsBookmarked = zcommon.Contains(userBookmarks, protoRepoMeta.Name)
|
protoRepoMeta.IsBookmarked = zcommon.Contains(userBookmarks, protoRepoMeta.Name)
|
||||||
|
|
||||||
|
|
|
@ -92,36 +92,36 @@ func GetDefaultConfig() ispec.Image {
|
||||||
|
|
||||||
func DefaultTimeRef() *time.Time {
|
func DefaultTimeRef() *time.Time {
|
||||||
var (
|
var (
|
||||||
year = 2010
|
year = 2010
|
||||||
month = time.Month(1)
|
month = time.Month(1)
|
||||||
day = 1
|
day = 1
|
||||||
hour = 1
|
hour = 1
|
||||||
min = 1
|
minute = 1
|
||||||
sec = 1
|
sec = 1
|
||||||
nsec = 0
|
nsec = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
return DateRef(year, month, day, hour, min, sec, nsec, time.UTC)
|
return DateRef(year, month, day, hour, minute, sec, nsec, time.UTC)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DateRef(year int, month time.Month, day, hour, min, sec, nsec int, loc *time.Location) *time.Time {
|
func DateRef(year int, month time.Month, day, hour, minute, sec, nsec int, loc *time.Location) *time.Time {
|
||||||
date := time.Date(year, month, day, hour, min, sec, nsec, loc)
|
date := time.Date(year, month, day, hour, minute, sec, nsec, loc)
|
||||||
|
|
||||||
return &date
|
return &date
|
||||||
}
|
}
|
||||||
|
|
||||||
func RandomDateRef(loc *time.Location) *time.Time {
|
func RandomDateRef(loc *time.Location) *time.Time {
|
||||||
var (
|
var (
|
||||||
year = 1990 + mathRand.Intn(30) //nolint: gosec,mnd
|
year = 1990 + mathRand.Intn(30) //nolint: gosec,mnd
|
||||||
month = time.Month(1 + mathRand.Intn(10)) //nolint: gosec,mnd
|
month = time.Month(1 + mathRand.Intn(10)) //nolint: gosec,mnd
|
||||||
day = 1 + mathRand.Intn(5) //nolint: gosec,mnd
|
day = 1 + mathRand.Intn(5) //nolint: gosec,mnd
|
||||||
hour = 1 + mathRand.Intn(22) //nolint: gosec,mnd
|
hour = 1 + mathRand.Intn(22) //nolint: gosec,mnd
|
||||||
min = 1 + mathRand.Intn(58) //nolint: gosec,mnd
|
minute = 1 + mathRand.Intn(58) //nolint: gosec,mnd
|
||||||
sec = 1 + mathRand.Intn(58) //nolint: gosec,mnd
|
sec = 1 + mathRand.Intn(58) //nolint: gosec,mnd
|
||||||
nsec = 1
|
nsec = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
return DateRef(year, month, day, hour, min, sec, nsec, time.UTC)
|
return DateRef(year, month, day, hour, minute, sec, nsec, time.UTC)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDefaultVulnConfig() ispec.Image {
|
func GetDefaultVulnConfig() ispec.Image {
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (olu BaseOciLayoutUtils) GetImageManifests(repo string) ([]ispec.Descriptor
|
||||||
|
|
||||||
buf, err := imageStore.GetIndexContent(repo)
|
buf, err := imageStore.GetIndexContent(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if goerrors.Is(zerr.ErrRepoNotFound, err) {
|
if goerrors.Is(err, zerr.ErrRepoNotFound) {
|
||||||
olu.Log.Error().Err(err).Msg("failed to get index.json contents because the file is missing")
|
olu.Log.Error().Err(err).Msg("failed to get index.json contents because the file is missing")
|
||||||
|
|
||||||
return nil, zerr.ErrRepoNotFound
|
return nil, zerr.ErrRepoNotFound
|
||||||
|
|
Loading…
Reference in a new issue