Trying to do something like this:

create_child_pipeline:
  tags:
    - windows
  stage: .pre
  script:
    - |
      @"
      child_job:
        tags:
          - windows
        stage: build
        script:
          - Write-Host "Here I am!"
      "@ > pipeline.yml
  artifacts:
    paths:
      - pipeline.yml
 
run_child_pipeline:
  stage: build
  trigger:
    include:
      - artifact: pipeline.yml
        job: create_child_pipeline

might result in a weird pipeline failure, with a message that the pipeline YAML is invalid. You check the artifact and it looks fine. What gives?

It’s an encoding problem: pipeline.yml gets encoded in UTF16 (because Windows), but the trigger job (which runs in a Linux context) pukes when trying to parse it.

Workaround: set the file encoding explicitly:

  script:
    - |
      @"
      child_job:
        tags:
          - windows
        stage: build
        script:
          - Write-Host "Here I am!"
      "@ | Out-File -Encoding ascii -Filepath pipeline.yml