Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Windows.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN $newPath = ('{0}\bin;C:\go\bin;{1}' -f $env:GOPATH, $env:PATH); \
# ideally we should be able to use FROM golang:windowsservercore-1803. This is not done due to two reasons
# 1. The go lang for 1803 tag is not available.

ENV GOLANG_VERSION 1.24.6
ENV GOLANG_VERSION 1.25.0

RUN $url = ('https://golang.org/dl/go{0}.windows-amd64.zip' -f $env:GOLANG_VERSION); \
Write-Host ('Downloading {0} ...' -f $url); \
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:

- task: GoTool@0
inputs:
version: '1.24.6'
version: '1.25.0'

- script: |
(robocopy $(system.defaultWorkingDirectory) $(ModulePath) /E /XD $(system.defaultWorkingDirectory)\work)^& IF %ERRORLEVEL% LSS 8 SET ERRORLEVEL = 0
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ steps:

- task: GoTool@0
inputs:
version: '1.24.6'
version: '1.25.0'

- script: |
set -e
Expand Down
28 changes: 20 additions & 8 deletions cmd/acr/purge_untagged_only_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ func TestPurgeAbacVerboseMode(t *testing.T) {
os.Stdout = w

// Call purge with verbose=true and ABAC enabled
deletedTagsCount, deletedManifestsCount, err := purge(
deletedTagsCount, deletedManifestsCount, purgeErr := purge(
testCtx,
mockClient,
testLoginURL,
Expand All @@ -830,15 +830,21 @@ func TestPurgeAbacVerboseMode(t *testing.T) {
)

// Restore stdout and read captured output
w.Close()
err := w.Close()
if err != nil {
t.Fatalf("Failed to close pipe writer: %v", err)
}
os.Stdout = oldStdout
var buf bytes.Buffer
io.Copy(&buf, r)
_, err = io.Copy(&buf, r)
if err != nil {
t.Fatalf("Failed to read from pipe: %v", err)
}
output := buf.String()

assert.Equal(0, deletedTagsCount, "No tags should be deleted")
assert.Equal(0, deletedManifestsCount, "No manifests deleted when none are untagged")
assert.Nil(err, "Error should be nil")
assert.Nil(purgeErr, "Error should be nil")
// Verify verbose output contains repository names
assert.Contains(output, "ABAC: Setting token scope for 3 repositories:", "Should output repo count")
assert.Contains(output, "repo1", "Should output repo1 in verbose mode")
Expand Down Expand Up @@ -883,7 +889,7 @@ func TestPurgeAbacVerboseMode(t *testing.T) {
os.Stdout = w

// Call purge with verbose=false and ABAC enabled
deletedTagsCount, deletedManifestsCount, err := purge(
deletedTagsCount, deletedManifestsCount, purgeErr := purge(
testCtx,
mockClient,
testLoginURL,
Expand All @@ -900,15 +906,21 @@ func TestPurgeAbacVerboseMode(t *testing.T) {
)

// Restore stdout and read captured output
w.Close()
err := w.Close()
if err != nil {
t.Fatalf("Failed to close pipe writer: %v", err)
}
os.Stdout = oldStdout
var buf bytes.Buffer
io.Copy(&buf, r)
_, err = io.Copy(&buf, r)
if err != nil {
t.Fatalf("Failed to read from pipe: %v", err)
}
output := buf.String()

assert.Equal(0, deletedTagsCount, "No tags should be deleted")
assert.Equal(0, deletedManifestsCount, "No manifests deleted when none are untagged")
assert.Nil(err, "Error should be nil")
assert.Nil(purgeErr, "Error should be nil")
// Verify non-verbose output contains count but NOT the repository list
assert.Contains(output, "ABAC: Setting token scope for 3 repositories", "Should output repo count")
// The non-verbose output should NOT contain the bracketed list of repos
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Azure/acr-cli

go 1.24.6
go 1.25.0

require (
github.com/Azure/go-autorest/autorest v0.11.30
Expand Down
6 changes: 3 additions & 3 deletions internal/api/acrsdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestGetAcrCLIClientWithAuth(t *testing.T) {
}
switch path {
case "/oauth2/token":
if err := r.ParseForm(); err != nil {
if err := r.ParseForm(); err != nil { //nolint:gosec // G120: test server, no risk of memory exhaustion
w.WriteHeader(http.StatusUnauthorized)
t.Fatal("unable to parse form")
}
Expand Down Expand Up @@ -263,7 +263,7 @@ func TestHasAadIdentityClaim(t *testing.T) {
}, "."),
expected: false,
},
{
{ //nolint:gosec // G101: not a real credential, test data
name: "invalid token",
token: "not-a-valid-jwt",
expected: false,
Expand Down Expand Up @@ -391,7 +391,7 @@ func TestRefreshAcrCLIClientTokenAbac(t *testing.T) {
w.WriteHeader(http.StatusNotFound)
return
}
if err := r.ParseForm(); err != nil {
if err := r.ParseForm(); err != nil { //nolint:gosec // G120: test server, no risk of memory exhaustion
w.WriteHeader(http.StatusBadRequest)
return
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup/dev_setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e -o pipefail

# binary will be $(go env GOPATH)/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.3.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/HEAD/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.11.3
Loading