include:
  - project: 'sre/ci-building-blocks'
    file: '/gitlab-ci/node/kaniko.yml'

audit npm modules:
  image: node:16-alpine
  stage: .pre
  script:
    - yarn audit --groups dependencies
  rules:
    - exists:
      - package.json
  allow_failure: true

publish image internal:
  extends: .publish image internal
  before_script:
    - apk add skopeo -q
    - echo $REGISTRY_USER
    - skopeo login -u "$REGISTRY_USER" -p "$REGISTRY_TOKEN" $REGISTRY
    - skopeo login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
  script:
    - "skopeo copy --insecure-policy docker://$CI_REGISTRY_IMAGE:$TAG_NAME docker://$REGISTRY/$OX_PROJECT/$OX_COMPONENT:$TAG_NAME"