Due to disk space limitations I want to expire my artifacts within a few hours.
Gitlab-CI supports this, by defining the time in expire_in
.
This works perfectly, but I have a manual deploy step (click a button to start the deploy). The deploy basically rsyncs the webroot to the server. The problem is when the artifacts are expired (in this example after 3 hours). If you hit the manual deploy button, errors will be thrown because the webroot
artifact no longer exists. The previous steps need to be rebuilt before deploy. All of this is perfectly understandable, but it's inconvenient to have to read through the error log to find out why the deploy failed.
I would like to disable the manual step (make the button unclickable), when the artifacts it depends on are no longer available. Is there any option to achieve this?
gitlab-ci.yaml
stages:
- build frontend
- build backend
- deploy
before_script:
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
npm build:
stage: build frontend
image: node:6
script:
- cd build
- yarn install
- npm run build:prod
artifacts:
paths:
- profile/
expire_in: 1 hour
drupal build:
stage: build backend
image: drupaldocker/drush:8
dependencies:
- npm build
script:
- sudo apt-get update
- sudo apt-get install unzip
- cd webroot
- drush make drupal.make.yml -y
- rm -r sites
artifacts:
paths:
- webroot/
expire_in: 3 hours
staging deploy:
stage: deploy
image: drupaldocker/drush:8
dependencies:
- drupal build
- npm build
script:
- export SSH_ENV_DIR="master1/drupal"
- bash bin/gitlab/deploy.sh
when: manual
environment:
name: staging