Forums

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

How to push only from the master branch (.yml file edits)

Kosta Kondratenko August 9, 2018

Hi,

I currently have a .yml file that pushes changes I make to my repository to an FTP. What I would like to do is edit it so that only changes made to the master branch is pushed to FTP - is this possible? Here is the .yml file:

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: samueldebruyn/debian-git

pipelines:
  default:
    - step:
        script:
          - apt-get update
          - apt-get -qq install git-ftp
          - git-ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD wetcheck.com.au

Also, what would be great is if there was even a staging branch so that changes made on the staging branch would be pushed to one FTP folder and changes made to the master would be pushed to another FTP folder.

Any input on this would be much appreciated.

Thanks!

1 answer

0 votes
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 9, 2018

Hi Kosta,

You can define branch requirements on a pipeline. See the documentation here for details: https://confluence.atlassian.com/bitbucket/branch-workflows-856697482.html

For example, you can change your configuration to this instead:

# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: samueldebruyn/debian-git

pipelines:
  branches:
master:
    - step:
         script:
           - apt-get update
           - apt-get -qq install git-ftp
           - git-ftp push --user $FTP_USERNAME --passwd $FTP_PASSWORD wetcheck.com.au
staging:
- step:
script:
- #something staging specific
default:
- step:
script:
- # all other branches will run this pipeline. For example, you may want to just check tests still pass on your branches.

Thanks,

Phil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events