Commit 4f34dbd1 authored by Federico Falconieri's avatar Federico Falconieri
Browse files

feat: adds monorepo and polirepo pipelines with sane defaults

also moves kaniko rules back to the job kaniko job
and deprecates docker.yml pipeline
parent 82dad419
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -22,11 +22,25 @@ variables:
  script:
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --cache=${KANIKO_CACHE} --context=${KANIKO_CONTEXT} --dockerfile=${KANIKO_DOCKERFILE} --destination=${KANIKO_REGISTRY_IMAGE}:${KANIKO_DEV_TAG} --destination=${KANIKO_REGISTRY_IMAGE}:${KANIKO_TAG} ${LABELS} ${KANIKO_EXTRA_ARGS}
  rules:
    # master/main
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
      variables:
        KANIKO_TAG: "latest"
    # tags
    - if: $CI_COMMIT_TAG
      variables:
        KANIKO_TAG: $CI_COMMIT_TAG
    # branches
    - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
      variables:
        KANIKO_TAG: ${CI_COMMIT_REF_SLUG}

# default for polirepos
kankiko:
  extends: .kaniko

# monorepos: user should extend this hidden job (one job for each container)
.kaniko:monorepo:
  extends: .kaniko
  variables:
+42 −0
Original line number Diff line number Diff line
---
include:
  - local: "docker/kaniko.yml"
  - local: "docker/grype.yml"

# skips default polirepo job inherited
kaniko:
  rules:
    - when: never

# skips default polirepo job inherited
grype:
  rules:
    - when: never

##### USAGE #####
# TODO: move to readme?

# by default, no job will run.
# the user needs to define manually a kaniko job and a grype job for each of his container images

# kaniko:image_A:
#   extends: .kaniko:monorepo:
#   variables:
#     CONTEXT_PATH: directory_A

# kaniko:image_B:
#   extends: .kaniko:monorepo:
#   variables:
#     CONTEXT_PATH: directory_B

# grype:image_A:
#   extends: .grype:monorepo
#   variables:
#     GRYPE_CONTEXT: directory_A
#   needs: ["kaniko:image_A"]

# grype:image_B:
#   extends: .grype:monorepo
#   variables:
#     GRYPE_CONTEXT: directory_B
#   needs: ["kaniko:image_B"]
+9 −0
Original line number Diff line number Diff line
---
include:
  - local: "docker/kaniko.yml"
  - local: "docker/grype.yml"

# set the project container dev image to the image for all jobs without a job-level default image
image:
  name: ${KANIKO_REGISTRY_IMAGE}:${KANIKO_DEV_TAG}
  entrypoint: [""]
+2 −0
Original line number Diff line number Diff line
# DEPRECATED

---
include:
  - local: "docker/kaniko.yml"