11//
2- // Copyright 2023-2025 The Chainloop Authors.
2+ // Copyright 2023-2026 The Chainloop Authors.
33//
44// Licensed under the Apache License, Version 2.0 (the "License");
55// you may not use this file except in compliance with the License.
@@ -91,13 +91,16 @@ func (s *gitlabPipelineSuite) TestListEnvVars() {
9191 {"CI_RUNNER_VERSION" , false },
9292 {"CI_RUNNER_DESCRIPTION" , true },
9393 {"CI_COMMIT_REF_NAME" , false },
94+ {"CI_PROJECT_PATH" , false },
95+ {"CI_JOB_TOKEN" , true },
9496 {"CI_PIPELINE_SOURCE" , true },
9597 {"CI_MERGE_REQUEST_IID" , true },
9698 {"CI_MERGE_REQUEST_TITLE" , true },
9799 {"CI_MERGE_REQUEST_DESCRIPTION" , true },
98100 {"CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" , true },
99101 {"CI_MERGE_REQUEST_TARGET_BRANCH_NAME" , true },
100102 {"CI_MERGE_REQUEST_PROJECT_URL" , true },
103+ {"CI_MERGE_REQUEST_PROJECT_PATH" , true },
101104 }, s .runner .ListEnvVars ())
102105}
103106
@@ -115,13 +118,16 @@ func (s *gitlabPipelineSuite) TestResolveEnvVars() {
115118 "CI_RUNNER_DESCRIPTION" : "chainloop-runner" ,
116119 "CI_COMMIT_REF_NAME" : "main" ,
117120 "CI_SERVER_URL" : "https://gitlab.com" ,
121+ "CI_PROJECT_PATH" : "chainloop/chainloop" ,
122+ "CI_JOB_TOKEN" : "gitlab-job-token" ,
118123 "CI_PIPELINE_SOURCE" : "merge_request_event" ,
119124 "CI_MERGE_REQUEST_IID" : "42" ,
120125 "CI_MERGE_REQUEST_TITLE" : "Add new feature" ,
121126 "CI_MERGE_REQUEST_DESCRIPTION" : "Implements awesome feature" ,
122127 "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" : "feature/awesome" ,
123128 "CI_MERGE_REQUEST_TARGET_BRANCH_NAME" : "main" ,
124129 "CI_MERGE_REQUEST_PROJECT_URL" : "https://gitlab.com/chainloop/chainloop/-/merge_requests/42" ,
130+ "CI_MERGE_REQUEST_PROJECT_PATH" : "chainloop/chainloop" ,
125131 }, resolvedEnvVars )
126132}
127133
@@ -135,6 +141,8 @@ func (s *gitlabPipelineSuite) TestResolveEnvVarsWithoutRunnerDescription() {
135141 s .T ().Setenv ("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" , "" )
136142 s .T ().Setenv ("CI_MERGE_REQUEST_TARGET_BRANCH_NAME" , "" )
137143 s .T ().Setenv ("CI_MERGE_REQUEST_PROJECT_URL" , "" )
144+ s .T ().Setenv ("CI_MERGE_REQUEST_PROJECT_PATH" , "" )
145+ s .T ().Setenv ("CI_JOB_TOKEN" , "" )
138146
139147 resolvedEnvVars , errors := s .runner .ResolveEnvVars ()
140148 s .Empty (errors , "Should not error when optional variables are missing" )
@@ -149,6 +157,7 @@ func (s *gitlabPipelineSuite) TestResolveEnvVarsWithoutRunnerDescription() {
149157 "CI_RUNNER_VERSION" : "13.10.0" ,
150158 "CI_COMMIT_REF_NAME" : "main" ,
151159 "CI_SERVER_URL" : "https://gitlab.com" ,
160+ "CI_PROJECT_PATH" : "chainloop/chainloop" ,
152161 }
153162 s .Equal (expected , resolvedEnvVars )
154163}
@@ -184,6 +193,9 @@ func (s *gitlabPipelineSuite) SetupTest() {
184193 t .Setenv ("CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" , "feature/awesome" )
185194 t .Setenv ("CI_MERGE_REQUEST_TARGET_BRANCH_NAME" , "main" )
186195 t .Setenv ("CI_MERGE_REQUEST_PROJECT_URL" , "https://gitlab.com/chainloop/chainloop/-/merge_requests/42" )
196+ t .Setenv ("CI_PROJECT_PATH" , "chainloop/chainloop" )
197+ t .Setenv ("CI_JOB_TOKEN" , "gitlab-job-token" )
198+ t .Setenv ("CI_MERGE_REQUEST_PROJECT_PATH" , "chainloop/chainloop" )
187199}
188200
189201// Run the tests
0 commit comments