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
22 changes: 6 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
name: Test Baton Gitlab Integration

on: pull_request
on:
pull_request:
push:
branches:
- main

jobs:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Bug: This PR removes the go-lint and go-test jobs from ci.yaml and also deletes main.yaml, which was the only other place those jobs ran. After this change no workflow in the repo runs golangci-lint or go test on pull requests or on push to maincapabilities_and_config.yaml only does go build, and update-dependencies.yaml is a scheduled maintenance job. The PR description says these jobs are "already covered by ci.yaml," but this same diff removes them. Unless a centralized reusable workflow (not present in this repo) runs lint/test, please keep a go-lint/go-test job on pull_request. (confidence: medium-high)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bug — lint/test are covered by the managed verify workflow (baton-admin), which is why @gontzess asked to drop these here. It is not a file in this repo, but verify / lint and verify / test run and pass on this PR, and also run on push to main (confirmed on the latest main commit). So no lint/test coverage is lost by removing the local go-lint/go-test jobs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Bug: This PR removes the go-lint and go-test jobs from ci.yaml in addition to deleting main.yaml. After merge, no workflow runs golangci-lint or go test on pull_request or push to main (the other workflows only go build or run integration tests needing secrets). The PR describes main.yaml as a redundant duplicate of jobs "already covered by ci.yaml," but this diff also deletes those jobs from ci.yaml, so lint/unit-test coverage is eliminated rather than deduplicated. If deduplication was the intent, keep go-lint/go-test in ci.yaml and only delete main.yaml.

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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: This PR removes the go-lint job from ci.yaml and deletes main.yaml (which also ran golangci-lint), leaving no workflow that runs golangci-lint on PRs or pushes to main. The commit intent was to deduplicate the lint job, but it's now eliminated entirely rather than kept in one place. Unless the shared verify.yaml@v4 reusable workflow runs lint, consider keeping a single go-lint job here. (medium confidence — depends on what the shared verify workflow covers)

strategy:
matrix:
Expand Down Expand Up @@ -190,6 +179,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
Expand Down
41 changes: 0 additions & 41 deletions .github/workflows/main.yaml

This file was deleted.

5 changes: 2 additions & 3 deletions pkg/connector/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
17 changes: 8 additions & 9 deletions pkg/connector/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand Down
16 changes: 8 additions & 8 deletions pkg/connector/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand All @@ -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),
}

Expand All @@ -493,6 +491,8 @@ func userResource(user any) (*v2.Resource, error) {
userResourceType,
id,
userTraitOptions,
resourceSdk.WithResourceProfile(profile),
resourceSdk.WithResourceStatus(userStatus, ""),
)
}

Expand Down
Loading