Add GitLab webhook support - #63
Open
jgsuess wants to merge 1 commit into
Open
Conversation
Accept GitLab push webhooks alongside GitHub, enabling public GitLab repositories to trigger IG builds and publish to build.fhir.org/ig/. - Detect platform via X-Gitlab-Event header - Normalise payloads into BuildRequest struct (platform.js) - Resolve ig.ini and HEAD via GitLab raw file URL / Commits API - Pass IG_CLONE_URL and IG_PLATFORM_URL to builder K8s Jobs - Namespace GitLab output under build.fhir.org/ig/gitlab.com/... - Support nested groups (org/subgroup/project) - 11 new tests for parsing and env injection Closes FHIR#19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add GitLab webhook support
Closes #19
Summary
This PR adds GitLab push webhook support to the IG auto-builder, enabling public GitLab repositories (gitlab.com and self-hosted instances) to trigger builds and publish to
build.fhir.org/ig/.The experience mirrors GitHub's manual webhook era: add a webhook URL to your GitLab project settings, and builds trigger on push. The architecture is designed to support a future GitLab Integration/OAuth App for one-click setup (analogous to the existing GitHub App).
What changes
Trigger function (
triggers/ig-commit-trigger/):platform.jsmodule detects GitLab viaX-Gitlab-Eventheader and normalises payloads into aBuildRequeststructhasIgIniandresolveHeaddispatch to GitLab's raw file URL / Commits API for GitLab reposscheduling.jsthreadscloneUrlandplatformUrlto the K8s Job asIG_CLONE_URLandIG_PLATFORM_URLenv varsbuild.fhir.org/platformannotation is added to jobs for observabilityBuilder image (
images/ig-publisher/):builder.pyusesIG_CLONE_URLif set (falls back to existing GitHub URL construction)IG_PLATFORM_URLfor source linksPublish script (
images/ci-build/publish-ig):IG_ORG(GitLab orgs are prefixed with hostname)Output namespacing:
build.fhir.org/ig/gitlab.com/:namespace/:project/branches/:branchmkdir -pand relative symlinks handle the nested paths correctlyDesign decisions
gitlab.com/namespace) rather than a separate path variable — minimises changes topublish-igandwatch-and-publishwhich already handleIG_ORG/IG_REPOpathsBuildRequestnormalisation boundary — adding other forges (Gitea, Bitbucket) later only requires a new parser inplatform.jsfetchagainst GitLab's public APIBackward compatibility
X-Gitlab-Eventheader)curltriggers without any platform header continue to work as GitHubIG_CLONE_URL/IG_PLATFORM_URLare optional — jobs without them behave exactly as beforeTesting
New tests cover:
user/project)org/subgroup/project,a/b/c/project)Not yet tested (need infrastructure)
IG_CLONE_URL(needs image rebuild)GitLab setup instructions (for users)
https://us-central1-fhir-org-starter-project.cloudfunctions.net/ig-commit-triggerOutput appears at:
https://build.fhir.org/ig/gitlab.com/:namespace/:project/branches/:branch