Skip to content

Commit 0c0dfef

Browse files
committed
feat: add config_schema and capabilities to record-release
Read config_schema.json and baton_capabilities.json from the connector repo checkout and send them in the RecordRelease API call. These files are generated by CI and committed to each connector repo. Also reorder job dependencies so record-connector-registry waits for record-lambda-registry to complete, ensuring the registry API recording has the full picture before firing.
1 parent e8e6517 commit 0c0dfef

2 files changed

Lines changed: 51 additions & 8 deletions

File tree

‎.github/workflows/release.yaml‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,12 @@ jobs:
908908
done < "$DIGEST_FILE"
909909
910910
record-connector-registry:
911-
# require binaries to succeed; windows (msi) and docker (images/lambda) may be skipped based on inputs
911+
# require binaries to succeed; windows, docker, and lambda recording may be skipped based on inputs
912912
# each optional job must succeed if it ran — a failure means incomplete release artifacts
913+
# waits for record-lambda-registry so the registry API recording has the full picture (config_schema, capabilities)
913914
# see: https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution
914-
if: ${{ !cancelled() && needs.goreleaser-binaries.result == 'success' && (needs.goreleaser-windows.result == 'success' || needs.goreleaser-windows.result == 'skipped') && (needs.goreleaser-docker.result == 'success' || needs.goreleaser-docker.result == 'skipped') }}
915-
needs: [determine-workflows-ref, goreleaser-binaries, goreleaser-windows, goreleaser-docker]
915+
if: ${{ !cancelled() && needs.goreleaser-binaries.result == 'success' && (needs.goreleaser-windows.result == 'success' || needs.goreleaser-windows.result == 'skipped') && (needs.goreleaser-docker.result == 'success' || needs.goreleaser-docker.result == 'skipped') && (needs.record-lambda-registry.result == 'success' || needs.record-lambda-registry.result == 'skipped') }}
916+
needs: [determine-workflows-ref, goreleaser-binaries, goreleaser-windows, goreleaser-docker, record-lambda-registry]
916917
permissions:
917918
id-token: write
918919
contents: read
@@ -1235,6 +1236,16 @@ jobs:
12351236
CHANGELOG_FLAG="-changelog /tmp/changelog.md"
12361237
fi
12371238
1239+
CONFIG_SCHEMA_FLAG=""
1240+
if [ -f "../_connector/config_schema.json" ]; then
1241+
CONFIG_SCHEMA_FLAG="-config-schema ../_connector/config_schema.json"
1242+
fi
1243+
1244+
CAPABILITIES_FLAG=""
1245+
if [ -f "../_connector/baton_capabilities.json" ]; then
1246+
CAPABILITIES_FLAG="-capabilities ../_connector/baton_capabilities.json"
1247+
fi
1248+
12381249
go run ./cmd/record-release \
12391250
-manifest _output/manifest.json \
12401251
-org "${{ github.event.repository.owner.login }}" \
@@ -1245,7 +1256,9 @@ jobs:
12451256
-workflow-run-id "${{ github.run_id }}" \
12461257
-registry-url "https://dist.conductorone.com" \
12471258
$DOCS_FLAG \
1248-
$CHANGELOG_FLAG
1259+
$CHANGELOG_FLAG \
1260+
$CONFIG_SCHEMA_FLAG \
1261+
$CAPABILITIES_FLAG
12491262
12501263
record-lambda-registry:
12511264
if: inputs.lambda == true

‎cmd/record-release/main.go‎

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ type RecordReleaseRequest struct {
2727
WorkflowRunID string `json:"workflowRunId"`
2828
Documentation string `json:"documentation,omitempty"`
2929
Changelog string `json:"changelog,omitempty"`
30+
ConfigSchema string `json:"configSchema,omitempty"`
31+
Capabilities json.RawMessage `json:"capabilities,omitempty"`
3032
SignatureURL string `json:"signatureUrl,omitempty"`
3133
CertificateURL string `json:"certificateUrl,omitempty"`
3234
Assets map[string]*ReleaseAsset `json:"assets,omitempty"`
@@ -76,9 +78,11 @@ func main() {
7678
repositoryURL string
7779
commitSha string
7880
workflowRunID string
79-
registryURL string
80-
changelogPath string
81-
token string
81+
registryURL string
82+
changelogPath string
83+
configSchemaPath string
84+
capabilitiesPath string
85+
token string
8286
)
8387

8488
flag.StringVar(&manifestPath, "manifest", "", "Path to merged manifest.json file (required)")
@@ -91,6 +95,8 @@ func main() {
9195
flag.StringVar(&workflowRunID, "workflow-run-id", "", "GitHub Actions workflow run ID (required)")
9296
flag.StringVar(&registryURL, "registry-url", "", "Registry API base URL (required)")
9397
flag.StringVar(&changelogPath, "changelog", "", "Path to a file containing release notes (optional)")
98+
flag.StringVar(&configSchemaPath, "config-schema", "", "Path to config_schema.json file (optional)")
99+
flag.StringVar(&capabilitiesPath, "capabilities", "", "Path to baton_capabilities.json file (optional)")
94100
flag.StringVar(&token, "token", "", "Bearer token (or set REGISTRY_API_TOKEN env var)")
95101
flag.Parse()
96102

@@ -175,7 +181,29 @@ func main() {
175181
}
176182
}
177183

178-
// Transform manifest assets: href->downloadUrl, signatureHref->signatureUrl, etc.
184+
// Read optional config_schema.json (committed to connector repo by CI)
185+
var configSchema string
186+
if configSchemaPath != "" {
187+
data, err := os.ReadFile(configSchemaPath)
188+
if err != nil {
189+
fmt.Fprintf(os.Stderr, "record-release: warning: could not read config-schema file: %v\n", err)
190+
} else {
191+
configSchema = string(data)
192+
}
193+
}
194+
195+
// Read optional baton_capabilities.json (committed to connector repo by CI)
196+
var capabilities json.RawMessage
197+
if capabilitiesPath != "" {
198+
data, err := os.ReadFile(capabilitiesPath)
199+
if err != nil {
200+
fmt.Fprintf(os.Stderr, "record-release: warning: could not read capabilities file: %v\n", err)
201+
} else {
202+
capabilities = data
203+
}
204+
}
205+
206+
// Transform manifest assets: href->downloadUrl, signatureHref->signatureUrl, etc.
179207
assets := make(map[string]*ReleaseAsset)
180208
for platform, asset := range manifest.GetAssets() {
181209
assets[platform] = &ReleaseAsset{
@@ -211,6 +239,8 @@ func main() {
211239
WorkflowRunID: workflowRunID,
212240
Documentation: documentation,
213241
Changelog: changelog,
242+
ConfigSchema: configSchema,
243+
Capabilities: capabilities,
214244
SignatureURL: manifest.GetSignatureHref(),
215245
CertificateURL: manifest.GetCertificateHref(),
216246
Assets: assets,

0 commit comments

Comments
 (0)