@@ -71,6 +71,10 @@ type InstanceInfo struct {
7171// to enable PR/MR auto-detection and commit verification when running Chainloop via Dagger inside those CI systems
7272type ParentCIContext struct {
7373 // Github Actions PR context
74+ // Repository name (owner/repo)
75+ GithubRepository string
76+ // Run ID for the workflow run
77+ GithubRunID string
7478 // Event name (e.g., "pull_request", "pull_request_target")
7579 GithubEventName string
7680 // Source branch name
@@ -81,6 +85,14 @@ type ParentCIContext struct {
8185 GithubToken * dagger.Secret
8286
8387 // Gitlab CI MR context
88+ // CI indicator (always "true" in Gitlab CI)
89+ GitlabCI string
90+ // Server URL (e.g., "https://gitlab.com")
91+ GitlabServerURL string
92+ // Project path (e.g., "group/project")
93+ GitlabProjectPath string
94+ // Job URL
95+ GitlabJobURL string
8496 // Pipeline source (should be "merge_request_event" for MRs)
8597 GitlabPipelineSource string
8698 // Merge request internal ID
@@ -128,6 +140,12 @@ func (m *Chainloop) Init(
128140 // Github event file for PR detection (when running in Github Actions)
129141 // +optional
130142 githubEventFile * dagger.File ,
143+ // Github repository name (owner/repo)
144+ // +optional
145+ githubRepository string ,
146+ // Github run ID for the workflow run
147+ // +optional
148+ githubRunID string ,
131149 // Github event name (e.g., "pull_request", "pull_request_target")
132150 // +optional
133151 githubEventName string ,
@@ -140,6 +158,18 @@ func (m *Chainloop) Init(
140158 // Github token for API access and commit verification (when running in Github Actions)
141159 // +optional
142160 githubToken * dagger.Secret ,
161+ // Gitlab CI indicator (should be "true" when running in Gitlab CI)
162+ // +optional
163+ gitlabCI string ,
164+ // Gitlab server URL (e.g., "https://gitlab.com")
165+ // +optional
166+ gitlabServerURL string ,
167+ // Gitlab project path (e.g., "group/project")
168+ // +optional
169+ gitlabProjectPath string ,
170+ // Gitlab job URL
171+ // +optional
172+ gitlabJobURL string ,
143173 // Gitlab pipeline source (should be "merge_request_event" for MRs)
144174 // +optional
145175 gitlabPipelineSource string ,
@@ -170,15 +200,22 @@ func (m *Chainloop) Init(
170200) (* Attestation , error ) {
171201 // Construct ParentCIContext from individual parameters
172202 var parentCIContext * ParentCIContext
173- if githubEventName != "" || githubHeadRef != "" || githubBaseRef != "" ||
203+ if githubRepository != "" || githubRunID != "" || githubEventName != "" || githubHeadRef != "" || githubBaseRef != "" ||
204+ gitlabCI != "" || gitlabServerURL != "" || gitlabProjectPath != "" || gitlabJobURL != "" ||
174205 gitlabPipelineSource != "" || gitlabMRIID != "" || gitlabMRTitle != "" ||
175206 gitlabMRDescription != "" || gitlabMRSourceBranch != "" || gitlabMRTargetBranch != "" ||
176207 gitlabMRProjectURL != "" || gitlabUserLogin != "" {
177208 parentCIContext = & ParentCIContext {
209+ GithubRepository : githubRepository ,
210+ GithubRunID : githubRunID ,
178211 GithubEventName : githubEventName ,
179212 GithubHeadRef : githubHeadRef ,
180213 GithubBaseRef : githubBaseRef ,
181214 GithubToken : githubToken ,
215+ GitlabCI : gitlabCI ,
216+ GitlabServerURL : gitlabServerURL ,
217+ GitlabProjectPath : gitlabProjectPath ,
218+ GitlabJobURL : gitlabJobURL ,
182219 GitlabPipelineSource : gitlabPipelineSource ,
183220 GitlabMRIID : gitlabMRIID ,
184221 GitlabMRTitle : gitlabMRTitle ,
@@ -461,6 +498,12 @@ func cliContainer(ttl int, token *dagger.Secret, instance InstanceInfo, parentCI
461498 // Inject parent CI context if provided
462499 if parentCI != nil {
463500 // Github Actions context
501+ if parentCI .GithubRepository != "" {
502+ ctr = ctr .WithEnvVariable ("GITHUB_REPOSITORY" , parentCI .GithubRepository )
503+ }
504+ if parentCI .GithubRunID != "" {
505+ ctr = ctr .WithEnvVariable ("GITHUB_RUN_ID" , parentCI .GithubRunID )
506+ }
464507 if parentCI .GithubEventName != "" {
465508 ctr = ctr .WithEnvVariable ("GITHUB_EVENT_NAME" , parentCI .GithubEventName )
466509 }
@@ -481,6 +524,18 @@ func cliContainer(ttl int, token *dagger.Secret, instance InstanceInfo, parentCI
481524 }
482525
483526 // Gitlab CI context
527+ if parentCI .GitlabCI != "" {
528+ ctr = ctr .WithEnvVariable ("GITLAB_CI" , parentCI .GitlabCI )
529+ }
530+ if parentCI .GitlabServerURL != "" {
531+ ctr = ctr .WithEnvVariable ("CI_SERVER_URL" , parentCI .GitlabServerURL )
532+ }
533+ if parentCI .GitlabProjectPath != "" {
534+ ctr = ctr .WithEnvVariable ("CI_PROJECT_PATH" , parentCI .GitlabProjectPath )
535+ }
536+ if parentCI .GitlabJobURL != "" {
537+ ctr = ctr .WithEnvVariable ("CI_JOB_URL" , parentCI .GitlabJobURL )
538+ }
484539 if parentCI .GitlabPipelineSource != "" {
485540 ctr = ctr .WithEnvVariable ("CI_PIPELINE_SOURCE" , parentCI .GitlabPipelineSource )
486541 }
0 commit comments