stages:
  - test
  - build

test:
  image: starefossen/ruby-node:latest
  stage: test
  script:
    - cd schedules
    - bundle install
    - yarn install
    - rails db:migrate
    - rails test
    - rubocop

build:
  stage: build
  retry: 2
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - mkdir -p /root/.docker
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /root/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR/schedules --dockerfile $CI_PROJECT_DIR/schedules/Dockerfile --destination $CI_REGISTRY_IMAGE/api:$CI_COMMIT_TAG
  only:
    - tags

stages:
  - test
  - build

test:
  image: starefossen/ruby-node:latest
  stage: test
  script:
    - cd schedules
    - bundle install
    - yarn install
    - rails db:migrate
    - rails test
    - rubocop

build:
  stage: build
  retry: 2
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
    - /kaniko/executor --context $CI_PROJECT_DIR/schedules --dockerfile $CI_PROJECT_DIR/schedules/Dockerfile --destination $CI_REGISTRY_IMAGE/api:$CI_COMMIT_TAG
  only:
    - tags

Update CI config for passing Kaniko credentials
Update CI config for passing Kaniko credentials
