Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Different pipeline steps for creating branch versus commit to branch

martinrowe
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 12, 2018

Im relatively new to pipelines but I have managed to get this up and running sucessfully and does 95% of what I need this to do. I understand how to execute different steps for certain branch types etc... and that is all fine. However I am struggling to find a suitable answer to my problem.

At present my set up I have a pipeline set up to run differently if the branch is a feature branch or master or default. However I would like to add some form of conditional logic to enable me to run slightly different steps when a feature branch gets created, versus commiting a change to an existing branch.

some kind of pseudo logic for this would be;

If 'trigger' = 'git branch' do xxxx

   else yyyy

 

Existing yml file below, requirement above would only need to be aplied to the feature/* branch. I would have thought this would be a fairly common requirement but I cannot find anything on this or I am missing somthing obvious!

 

pipelines:
  default:
    - step:
       name: deploy to dev
       deployment: test
       script:
           - apt-get update
           - apt-get -qq install git-ftp
           - git ftp push --user $FTP_USER --passwd $FTP_PWD $FTP_URL.$FTP_DEV_SITE
  branches:
    master:
      - step:
         name: deploy to production
         deployment: production
         script:
             - apt-get update
             - apt-get -qq install git-ftp
             - git ftp push --user $FTP_USER --passwd $FTP_PWD $FTP_URL.$FTP_PROD_SITE
    feature/*:
      - step:
         name: deploy to staging
         deployment: staging
         script:
             - apt-get update
             - apt-get -qq install git-ftp
             - git ftp push --user $FTP_USER --passwd $FTP_PWD $FTP_URL.$FTP_STAGE_SITE

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events