From 25a3f2ae9f90a2bd2dc0dbe68363dd3d26050cb3 Mon Sep 17 00:00:00 2001 From: Luisina Santos Date: Thu, 16 Jul 2026 11:36:07 -0300 Subject: [PATCH 1/3] chore: remove redundant main.yaml CI workflow main.yaml duplicated the go-lint/go-test jobs already covered by ci.yaml, just triggered on push to main instead of pull_request. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/main.yaml | 41 ------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml deleted file mode 100644 index dba9bd2d..00000000 --- a/.github/workflows/main.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: main ci -on: - push: - branches: - - main -jobs: - go-lint: - runs-on: ubuntu-latest - steps: - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: 1.23.x - - name: Checkout code - uses: actions/checkout@v3 - - name: Run linters - uses: golangci/golangci-lint-action@v8 - with: - version: latest - args: --timeout=3m - go-test: - strategy: - matrix: - go-version: [ 1.23.x ] - platform: [ ubuntu-latest ] - runs-on: ${{ matrix.platform }} - steps: - - name: Install Go - if: success() - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go-version }} - - name: Checkout code - uses: actions/checkout@v4 - - name: go tests - run: (set -o pipefail && go test -v -covermode=count -json ./... | tee test.json) - - name: annotate go tests - if: always() - uses: guyarb/golang-test-annotations@v0.5.1 - with: - test-results: test.json \ No newline at end of file From 1a59dc55b81d7512994e849c3b75693e3b419ccd Mon Sep 17 00:00:00 2001 From: Luisina Santos Date: Thu, 16 Jul 2026 11:41:24 -0300 Subject: [PATCH 2/3] chore: restore push-to-main trigger on ci.yaml main.yaml previously ran go-lint/go-test on push to main; now that it's removed, ci.yaml picks up that trigger directly. test-cloud-version stays PR-only since it hits the real GitLab API and wasn't part of main.yaml's scope. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 73172587..68a3b63a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,10 @@ name: Test Baton Gitlab Integration -on: pull_request +on: + pull_request: + push: + branches: + - main jobs: go-lint: @@ -190,6 +194,7 @@ jobs: # jq --exit-status ".grants[].principal.id.resource == \"${{ env.USER_ID }}\"" test-cloud-version: + if: github.event_name == 'pull_request' runs-on: ubuntu-latest env: BATON_LOG_LEVEL: debug From 8802e8118a84ac486bb8d270c6157249f13626bb Mon Sep 17 00:00:00 2001 From: Luisina Santos Date: Tue, 21 Jul 2026 16:15:28 -0300 Subject: [PATCH 3/3] fix: migrate deprecated SDK trait options and drop redundant lint job Migrate WithGroupProfile/WithUserProfile/WithStatus (deprecated, SA1019) to the resource-level WithResourceProfile/WithResourceStatus options in groups.go, projects.go, and users.go. Remove the redundant go-lint job from the "Test Baton Gitlab Integration" workflow; verify.yaml's `verify / lint` already covers it. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yaml | 15 --------------- pkg/connector/groups.go | 5 ++--- pkg/connector/projects.go | 17 ++++++++--------- pkg/connector/users.go | 16 ++++++++-------- 4 files changed, 18 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 68a3b63a..3414f344 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,21 +7,6 @@ on: - main jobs: - go-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - - name: Run linters - uses: golangci/golangci-lint-action@v8 - with: - version: latest - args: --timeout=3m - go-test: strategy: matrix: diff --git a/pkg/connector/groups.go b/pkg/connector/groups.go index a75e5c32..94337da8 100644 --- a/pkg/connector/groups.go +++ b/pkg/connector/groups.go @@ -427,9 +427,8 @@ func groupResource(group *client.Group, parentResourceID *v2.ResourceId, isOnPre group.FullName, groupResourceType, toGroupResourceId(strconv.Itoa(group.ID)), - []resourceSdk.GroupTraitOption{ - resourceSdk.WithGroupProfile(profile), - }, + []resourceSdk.GroupTraitOption{}, + resourceSdk.WithResourceProfile(profile), resourceSdk.WithAnnotation(annos...), resourceSdk.WithParentResourceID(parentResourceID), ) diff --git a/pkg/connector/projects.go b/pkg/connector/projects.go index f3c9f4be..da18abb4 100644 --- a/pkg/connector/projects.go +++ b/pkg/connector/projects.go @@ -342,15 +342,14 @@ func projectResource(project *client.Project, parentResourceID *v2.ResourceId, i project.NameWithNamespace, projectResourceType, project.ID, - []resourceSdk.GroupTraitOption{ - resourceSdk.WithGroupProfile( - map[string]interface{}{ - "id": project.ID, - profileFieldName: project.Name, - "description": project.Description, - }, - ), - }, + []resourceSdk.GroupTraitOption{}, + resourceSdk.WithResourceProfile( + map[string]interface{}{ + "id": project.ID, + profileFieldName: project.Name, + "description": project.Description, + }, + ), resourceSdk.WithAnnotation(annotations...), resourceSdk.WithParentResourceID(parentResourceID), ) diff --git a/pkg/connector/users.go b/pkg/connector/users.go index 3a60b1ed..08ae3716 100644 --- a/pkg/connector/users.go +++ b/pkg/connector/users.go @@ -276,8 +276,8 @@ func (u *userBuilder) createCloudUser( []resourceSdk.UserTraitOption{ resourceSdk.WithEmail(email, true), resourceSdk.WithUserLogin(email), - resourceSdk.WithStatus(v2.UserTrait_Status_STATUS_DISABLED), }, + resourceSdk.WithResourceStatus(v2.Status_RESOURCE_STATUS_DISABLED, ""), ) if err != nil { return nil, nil, nil, fmt.Errorf("failed to build pending user resource: %w", err) @@ -447,20 +447,20 @@ func userResource(user any) (*v2.Resource, error) { []resourceSdk.UserTraitOption{ resourceSdk.WithEmail(email, true), resourceSdk.WithUserLogin(email), - resourceSdk.WithUserProfile(profile), - resourceSdk.WithStatus(v2.UserTrait_Status_STATUS_DISABLED), }, + resourceSdk.WithResourceProfile(profile), + resourceSdk.WithResourceStatus(v2.Status_RESOURCE_STATUS_DISABLED, ""), ) default: return nil, fmt.Errorf("unknown user type: %T", user) } - userStatus := v2.UserTrait_Status_STATUS_ENABLED + userStatus := v2.Status_RESOURCE_STATUS_ENABLED switch state { case "blocked", "deactivated", "ldap_blocked", "banned": - userStatus = v2.UserTrait_Status_STATUS_DISABLED + userStatus = v2.Status_RESOURCE_STATUS_DISABLED case "pending": - userStatus = v2.UserTrait_Status_STATUS_UNSPECIFIED + userStatus = v2.Status_RESOURCE_STATUS_UNSPECIFIED name = pendingInvitationUser + strings.ToLower(email) } @@ -479,8 +479,6 @@ func userResource(user any) (*v2.Resource, error) { userTraitOptions := []resourceSdk.UserTraitOption{ resourceSdk.WithEmail(email, true), - resourceSdk.WithStatus(userStatus), - resourceSdk.WithUserProfile(profile), resourceSdk.WithUserLogin(email), } @@ -493,6 +491,8 @@ func userResource(user any) (*v2.Resource, error) { userResourceType, id, userTraitOptions, + resourceSdk.WithResourceProfile(profile), + resourceSdk.WithResourceStatus(userStatus, ""), ) }