Hello,
I’ve set a pipeline for feature branches like the following one :
The deployment is quite ressource hungry, so we want to deploy only for some selected branches. The first stage ask the user if a deploy is required, then all steps are run if the first one is ran. This is what we wanted but, merge requests are blocked and require the user to do a deploy before we merge.
The code for this pipeline
stages:
- checkout
- config
- install
- test
- build
- link
- cleanup
variables:
GIT_URL: ...
SSH_CMD: ...
COMPOSER: ...
ENV_DIR: ...
COMMON_DIR: ...
DIR: ...
BRANCH_DIR: ...
SHA_DIR: ...
API_DIR: ...
CLIENT_DIR: ...
MAP_DIR: ...
SYNC_DIR: ...
KEEP_N_DIR: ...
checkout:branch:
stage: checkout
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Checkout branch to staging server"
when: manual
allow_failure: false
only:
- branches
except:
- master
- staging
- develop
checkout:staging:
stage: checkout
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Checkout branch to staging server"
when: on_success
allow_failure: false
only:
- staging
except:
- master
- develop
config:
stage: config
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Configure apps"
when: on_success
only:
- branches
except:
- master
- develop
config:db:
stage: config
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Configure db"
when: on_success
only:
- branches
except:
- master
- develop
config:api:
stage: config
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Configure apps"
when: on_success
only:
- branches
except:
- master
- develop
config:client:
stage: config
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Configure apps"
when: on_success
only:
- branches
except:
- master
- develop
config:map:
stage: config
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Configure apps"
when: on_success
only:
- branches
except:
- master
- develop
config:sync:
stage: config
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Configure apps"
when: on_success
only:
- branches
except:
- master
- develop
install:api:
stage: install
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_NAME.api.mydomain.com
script:
- echo "-> Build API"
when: on_success
only:
- branches
except:
- master
- develop
install:client:
stage: install
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_NAME.extranet.mydomain.com
script:
- echo "-> Build extranet client"
when: on_success
only:
- branches
except:
- master
- develop
install:map:
stage: install
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_NAME.map.mydomain.com
script:
- echo "-> Build map client"
when: on_success
only:
- branches
except:
- master
- develop
install:sync:
stage: install
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> Build sync cli"
when: on_success
only:
- branches
except:
- master
- develop
test:client:
stage: test
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_NAME.extranet.mydomain.com
script:
- echo "-> Test extranet client"
when: on_success
only:
- branches
except:
- master
- develop
build:api:
stage: build
script:
- echo "-> Build api"
only:
- branches
except:
- master
- develop
build:db:
stage: build
script:
- echo "-> Build db"
only:
- branches
except:
- master
- develop
build:client:
stage: build
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_NAME.extranet.mydomain.com
script:
- echo "-> Build extranet client"
when: on_success
only:
- branches
except:
- master
- develop
build:map:
stage: build
environment:
name: branch/$CI_COMMIT_REF_NAME
url: https://$CI_COMMIT_REF_NAME.map.mydomain.com
script:
- echo "-> Build map client"
when: on_success
only:
- branches
except:
- master
- develop
build:sync:
stage: build
environment:
name: branch/$CI_COMMIT_REF_NAME
script:
- echo "-> 👯♀️ Run sync client"
when: on_success
only:
- branches
except:
- master
- develop
link:
stage: link
script:
- echo "-> Link current version"
only:
- branches
except:
- master
- develop
cleanup:success:
stage: cleanup
script:
- echo "-> Keep only last $KEEP_N_DIR deploys"
only:
- branches
except:
- master
- develop
cleanup:failed:
stage: cleanup
script:
- echo "-> Move failed deploys"
when: on_failure
except:
- master
- develop
How can I have a blocking manual action that don’t blocks MR ?
Thank you