{"record":{"id":"2b2462be3db9e556","repo":"hashicorp/packer","slug":"gitlab-ci-environment-variable-not-found","errorCode":null,"errorMessage":"GITLAB_CI environment variable not found","messagePattern":"GITLAB_CI environment variable not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hcp/registry/metadata/cicd.go","lineNumber":55,"sourceCode":"\t\tif value, ok := os.LookupEnv(key); ok {\n\t\t\tenv[key] = value\n\t\t}\n\t}\n\n\tenv[\"GITHUB_WORKFLOW_URL\"] = fmt.Sprintf(\"%s/%s/actions/runs/%s\", os.Getenv(\"GITHUB_SERVER_URL\"), os.Getenv(\"GITHUB_REPOSITORY\"), os.Getenv(\"GITHUB_RUN_ID\"))\n\treturn env\n}\n\nfunc (g *GithubActions) Type() string {\n\treturn \"github\"\n}\n\ntype GitlabCI struct{}\n\nfunc (g *GitlabCI) Detect() error {\n\t_, ok := os.LookupEnv(\"GITLAB_CI\")\n\tif !ok {\n\t\treturn fmt.Errorf(\"GITLAB_CI environment variable not found\")\n\t}\n\treturn nil\n}\n\nfunc (g *GitlabCI) Details() map[string]interface{} {\n\tenv := make(map[string]interface{})\n\tkeys := []string{\n\t\t\"CI_PROJECT_NAME\",\n\t\t\"CI_PROJECT_ID\",\n\t\t\"CI_PROJECT_URL\",\n\t\t\"CI_COMMIT_SHA\",\n\t\t\"CI_COMMIT_REF_NAME\",\n\t\t\"GITLAB_USER_NAME\",\n\t\t\"GITLAB_USER_ID\",\n\t\t\"CI_PIPELINE_SOURCE\",\n\t\t\"CI_PIPELINE_URL\",\n\t\t\"CI_JOB_URL\",\n\t\t\"CI_SERVER_NAME\",","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/internal/hcp/registry/metadata/cicd.go#L37-L73","documentation":"CI/CD environment detection for HCP Packer registry metadata. GitlabCI.Detect probes for the GITLAB_CI variable that GitLab sets automatically in its CI runners; this error means Packer was not running inside a GitLab CI pipeline, so this detector does not apply. It is normally benign — the registry simply tries other detectors — and only matters if GitLab metadata was expected, in which case verify the build actually runs in GitLab CI.","triggerScenarios":"Thrown at internal/hcp/registry/metadata/cicd.go:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Expected negative detection; try the next CI provider in the chain","Run the build from a GitLab pipeline job if GitLab metadata is required"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}