Skip to content

feat: add test, lint, audit jobs for custom type

Luboš Matejčík requested to merge feat/custom-test-jobs into main

Currently custom job only generates pipeline job for build step but pipeline jobs for test, lint and audit are not generated.

This MR adds generating pipeline jobs for test, lint, audit for custom job type.

Tested with:

// catladder.ts
// ...
      build: {
        type: "custom",
        docker: { type: "custom" },
        jobImage: "maven:3.8.6-openjdk-18",
        jobServices: [
          {
            name: "docker:18-dind",
            command: ["--tls=false"]
          }
        ],
        buildCommand: ["mvn package -DskipTests", "cp -r target dist"],
        artifactsReports: {
          junit: ["dist/surefire-reports/TEST-*.xml"]
        },
        test: {
          command: ["mvn test"]
        },
        audit: {
          command: ["mvn org.owasp:dependency-check-maven:aggregate"]
        },
      },
// ...

Result:

// __pipeline.yml
api 🛡 audit:
  variables: &ref_0
    APP_PATH: backend
    KUBERNETES_CPU_REQUEST: '0.5'
    KUBERNETES_CPU_LIMIT: '2'
    KUBERNETES_MEMORY_REQUEST: 2Gi
    KUBERNETES_MEMORY_LIMIT: 4Gi
  stage: test
  image: maven:3.8.6-openjdk-18
  script:
    - mvn org.owasp:dependency-check-maven:aggregate
  allow_failure: true
  needs: []
  retry: &ref_1
    max: 2
    when:
      - runner_system_failure
      - stuck_or_timeout_failure
  interruptible: true
api 🧪 test:
  variables: *ref_0
  stage: test
  image: maven:3.8.6-openjdk-18
  script:
    - mvn test
  needs: []
  retry: *ref_1
  interruptible: true
...

https://git.panter.ch/panter/swisssign/-/pipelines/180774

Edited by Luboš Matejčík

Merge request reports