Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flatten shared steps to jobs in the pipeline template #3105

Closed
VonnyJap opened this issue Apr 30, 2024 · 0 comments
Closed

Flatten shared steps to jobs in the pipeline template #3105

VonnyJap opened this issue Apr 30, 2024 · 0 comments
Assignees
Labels
pipeline-template subtask issue that is categorized as subtask of another issue
Milestone

Comments

@VonnyJap
Copy link
Member

VonnyJap commented Apr 30, 2024

What happened:

The default action for flattening shared steps is overwriting, which means that steps in the job configuration will overwrite those defined in the shared steps. See the current implementation according to https://github.com/screwdriver-cd/template-validator/pull/39/files

What you expected to happen:

When screwdriver.cd/mergeSharedSteps is set to true, either from the job or shared configuration, the steps are merged between the shared configuration and those defined in the job template configuration.

Given an example of a pipeline template using job template and annotation screwdriver.cd/mergeSharedSteps with the configuration below.

namespace: sd-test
name: example-template
version: '1.0.0'
description: An example pipeline template for testing golang files
maintainer: foo@bar.com
config:
  shared:
    annotations:
      screwdriver.cd/mergeSharedSteps: true
    steps:
       - premotd: echo build
  jobs:
    main:
      template: python/package_rpm@latest
      requires: [~pr, ~commit]
      steps:
        - preinit_os: echo replace
        - begin: echo begin

The resulting configuration after flattening would be

jobs:
  main:
    steps:
      - begin: echo begin
      - premotd: echo build
      - motd: cat << EOF
          This job will generate rpm packages, check them repository.
        EOF
      - preinit_os: echo replace
      - init_os: sd-cmd exec python/python_bootstrap@stable
        source /tmp/python_bootstrap.env
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pipeline-template subtask issue that is categorized as subtask of another issue
Projects
Development

No branches or pull requests

2 participants