Skip to main content

export_gitlab_ci

Function export_gitlab_ci 

Source
pub fn export_gitlab_ci(
    session: &Session,
    params: Option<&[Parameter]>,
) -> String
Expand description

Export a session as a GitLab CI configuration YAML.

Generates a .gitlab-ci.yml with:

  • Metadata header comments (session name, date, command count)
  • Single build stage and job
  • ubuntu:22.04 Docker image
  • variables: block when parameters are provided
  • cd commands in the script array when cwd changes
  • Commands passed through escape_yaml() for safe YAML output
  • Annotations for failed commands (non-zero exit codes)

When params is Some, a variables: block is added at job level and commands use $VAR references.

Empty sessions produce a valid config with a placeholder script entry (GitLab CI requires at least one script entry).