Skip to content

Add CI/CD components/templates #40

@gardar

Description

@gardar

Describe the idea

It would be great if there were gitlab-ci templates or better yet components (https://about.gitlab.com/blog/2023/12/21/introducing-the-gitlab-ci-cd-catalog-beta/) published, that way one could simply import the convert jobs.

How to implement?
It should be possible to base it on the examples that are in the readme, but with the addition of spec:inputs

Something like this:

---
spec:
  inputs:
    job_name:
      description: "Change the name of the secret detection job (required when including the component multiple times)"
      default: secret_detection_convert
    stage:
      description: "Override the default job stage"
      default: test
    image_location:
      description: "Override the location of the secscanner2junit container (for local mirrors)"
      default: "docker.io/angrymeir/secscanner2junit:latest"
    secret_detection_report:
      description: "Secret detection report filename"
      default: "gl-secret-detection-report.json"
---


include:
  - component: gitlab.com/components/secret-detection/secret-detection@main
    inputs:
      stage: $[[ inputs.stage ]]

secret_detection:
  artifacts:
    paths:
      - $[[ inputs.secret_detection_report ]]
    when: always

$[[ inputs.job_name ]]:
  stage: $[[ inputs.stage ]]
  image:
    name: $[[ inputs.image_location ]]
    entrypoint: [""]
  needs:
    - secret_detection
  script:
    - ss2ju secrets $[[ inputs.secret_detection_report ]] gl-secret-detection-report.xml
  artifacts:
    reports:
      junit: gl-secret-detection-report.xml

As a user I could then simply define something like this in my .gitlab-ci.yml

include:
  - component: gitlab.com/components/path-to/secscanner2junit@main

or

include:
  - component: gitlab.com/components/path-to/secscanner2junit@main
    inputs:
      stage: secrets

etc.

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