PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 9, 2022

[FIXED] How to print/debug all jobs of includes in GitLab CI?

 October 09, 2022     continuous-integration, gitlab, gitlab-ci, nested-includes     No comments   

Issue

In Gitlab CI it is possible to include one or many files in a .gitlab-ci.yml file. It is even possible to nest these includes. See https://docs.gitlab.com/ee/ci/yaml/includes.html#using-nested-includes.

How can I see the resulting CI file all at once?

Right now, when I debug a CI cycle, I open every single include file and combine the resulting file structure by myself. There has to be a better way.

Example

Content of https://company.com/autodevops-template.yml:

variables:
  POSTGRES_USER: user
  POSTGRES_PASSWORD: testing_password
  POSTGRES_DB: $CI_ENVIRONMENT_SLUG

production:
  stage: production
  script:
    - install_dependencies
    - deploy
  environment:
    name: production
    url: https://$CI_PROJECT_PATH_SLUG.$KUBE_INGRESS_BASE_DOMAIN
  only:
    - master

Content of .gitlab-ci.yml:

include: 'https://company.com/autodevops-template.yml'

image: alpine:latest

variables:
  POSTGRES_USER: root
  POSTGRES_PASSWORD: secure_password

stages:
  - build
  - test
  - production

production:
  environment:
    url: https://example.com

This should result in the following file structure:

image: alpine:latest

variables:
  POSTGRES_USER: root
  POSTGRES_PASSWORD: secure_password
  POSTGRES_DB: $CI_ENVIRONMENT_SLUG

stages:
  - build
  - test
  - production

production:
  stage: production
  script:
    - install_dependencies
    - deploy
  environment:
    name: production
    url: https://example.com
  only:
    - master

→ How can I see this output somewhere?

Environment

  • Self-Hosted GitLab 13.9.1

Solution

As I continued to search for a solution, I read about a “Pipeline Editor“ which was released in GitLab version 13.8 this year. Turns out that the feature I am looking for was added to this editor just some days ago:

Version 13.9.0 (2021-02-22) „View an expanded version of the CI/CD configuration” → see Release Notes for a feature description and introduction video.

To view the fully expanded CI/CD configuration as one combined file, go to the pipeline editor’s »View merged YAML« tab. This tab displays an expanded configuration where:

  • Configuration imported with include is copied into the view.
  • Jobs that use extends display with the extended configuration merged into the job.
  • YAML anchors are replaced with the linked configuration

Usage: Open project → Module »CI / CD« → Submodule »Editor« → Tab »View merged YAML«

Screenshot Pipeline Editor Merged Configuration Tab



Answered By - pixelbrackets
Answer Checked By - Mildred Charles (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing