Skip to content
Draft
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
12 changes: 5 additions & 7 deletions .github/workflows/capabilities_and_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,20 @@ jobs:
with:
go-version-file: "go.mod"

- name: Build
run: go build -o connector ./cmd/baton-gitlab

- name: Run and save config output
run: ./connector config > config_schema.json
- name: Generate setup artifacts
run: make generate-setup-artifacts

- name: Run and save capabilities output
env:
BATON_ACCESS_TOKEN: "${{ secrets.BATON_ACCESS_TOKEN }}"
run: ./connector capabilities --access-token=access_token --base-url=base_url --account-creation-group=group > baton_capabilities.json
run: ./dist/linux_amd64/baton-gitlab capabilities --access-token=access_token --base-url=base_url --account-creation-group=group > baton_capabilities.json

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: The binary path ./dist/linux_amd64/baton-gitlab is hardcoded, while the Makefile builds to dist/$(GOOS)_$(GOARCH). If this job's runs-on arch/OS ever changes, this path breaks silently. Consider deriving the path from the runner env or a make variable to keep it in sync. (low confidence)


- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Updating baton config schema and capabilities.'
add: |
pkg/config/conf.gen.go
config_schema.json
baton_capabilities.json
baton_capabilities.json
20 changes: 20 additions & 0 deletions .github/workflows/verify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ on:
- main

jobs:
setup-artifacts:

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 file's header declares it "managed by baton-admin. DO NOT EDIT!!!", but this PR adds the setup-artifacts job here manually. If baton-admin regenerates this workflow, the new job may be silently clobbered. Confirm this addition is applied through the baton-admin template/generator rather than as a one-off edit. (low confidence)

name: Verify setup artifacts
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"

- name: Verify setup artifacts
run: make verify-setup-artifacts

verify:
uses: ConductorOne/github-workflows/.github/workflows/verify.yaml@v4
with:
Expand Down
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ GOOS = $(shell go env GOOS)
GOARCH = $(shell go env GOARCH)
BUILD_DIR = dist/${GOOS}_${GOARCH}
GENERATED_CONF := pkg/config/conf.gen.go
GENERATED_SETUP_ARTIFACTS := $(GENERATED_CONF) config_schema.json

ifeq ($(GOOS),windows)
OUTPUT_PATH = ${BUILD_DIR}/baton-gitlab.exe
Expand All @@ -16,7 +17,7 @@ else
BUILD_TAGS=
endif

.PHONY: build
.PHONY: build generate-setup-artifacts verify-setup-artifacts
build: $(GENERATED_CONF)
go build ${BUILD_TAGS} -o ${OUTPUT_PATH} ./cmd/baton-gitlab

Expand All @@ -26,6 +27,22 @@ $(GENERATED_CONF): pkg/config/config.go go.mod

generate: $(GENERATED_CONF)

generate-setup-artifacts:
@echo "Generating $(GENERATED_CONF)..."
go generate ./pkg/config
@echo "Building connector for config schema generation..."
go build ${BUILD_TAGS} -o ${OUTPUT_PATH} ./cmd/baton-gitlab
@echo "Generating config_schema.json..."
${OUTPUT_PATH} config > config_schema.json

verify-setup-artifacts: generate-setup-artifacts
@stale_paths="$$(git diff --name-only -- $(GENERATED_SETUP_ARTIFACTS))"; \
if [ -n "$$stale_paths" ]; then \
echo "Setup artifacts are stale:"; \
printf '%s\n' "$$stale_paths"; \
git diff --exit-code -- $(GENERATED_SETUP_ARTIFACTS); \
fi

.PHONY: update-deps
update-deps:
go get -d -u ./...
Expand All @@ -39,4 +56,4 @@ add-dep:

.PHONY: lint
lint:
golangci-lint run
golangci-lint run
12 changes: 7 additions & 5 deletions pkg/config/conf.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading