Skip to content

Gitlab CI_PIPELINE_ID has exceeded the int limits on gitlab.com and the variable should be changed to a long #4656

@drewgle

Description

@drewgle

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake Frosting

Cake version

6.0.0

Operating system

Windows, Linux

Operating system architecture

x64

CI Server

Gitlab.com

What are you seeing?

Git lab's build pipeline uses a global IID that has currently exceeded the integer limit of 2,147,483,647. When trying to access context.GitLabCI().Environment.Build.PipelineId 0 is always returned because a try parse returns false.

What is expected?

The pipeline ID should be returned as a long instead of an int. This will ensure the value continues to be returned as more pipelines are run.

Steps to Reproduce

Using .NET 8 or 10, I was able to reproduce with the following. The output is 0

new CakeHost()
            .UseContext<BuildContext>()
            .Run(args);
public class BuildContext : FrostingContext
{
    public long PipelineId { get; set; } = 0;

    public BuildContext(ICakeContext context)
        : base(context)
    {
            if (context.BuildSystem().GitLabCI.IsRunningOnGitLabCI)
            {
               PipelineId context.GitLabCI().Environment.Build.PipelineId
            }
    }
}
[TaskName("Default")]
public sealed class DefaultTask: FrostingTask<BuildContext>
{
    public override void Run(BuildContext context)
    {
        context.Log.Information("Cake ParsedID: " + context.PipelineId);
        context.Log.Information("Actual PipelineID: " + Environment.GetEnvironmentVariable("CI_PIPELINE_ID"));
    }
}

Output log

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions