Bitbucket Pipelines is an integrated CI/CD service, built into Bitbucket. It allows us to automatically build, test and even deploy our code, based on a configuration file in our repository. To set up Pipelines we need to create and configure the bitbucket-pipelines.yml file in the root directory of our repository.
Continuous Delivery Vs Continuous Integration
Continuous delivery is a software development methodology where the release process is automated. Every software change is automatically built, tested, and deployed to production. Before the final push to production, a person, an automated test, or a business rule decides when the final push should occur. Although every successful software change can be immediately released to production with continuous delivery, not all changes need to be released right away.
Continuous integration is a software development practice where members of a team use a version control system and frequently integrate their work to the same location, such as a master branch. Each change is built and verified to detect integration errors as quickly as possible. Continuous integration is focused on automatically building and testing code, as compared to continuous delivery, which automates the entire software release process up to production.
Example: Bitbucket Pipeline to zip the source code and upload to S3 bucket.
Following are the steps for creating a pipeline in Bitbucket. In this example, the pipeline will zip the source code and upload the zip file to AWS S3 bucket.
Note: For creating the code pipeline in Bitbucket, you must be either the owner of the repo or you have the necessary permissions on the repo.
- Open the repository you want to create a pipeline
- Click on Settings
- Under Pipelines Section -> Go to Settings
- Click on Enable Pipelines
- Go to Repository variables under Pipelines and enter the following
- Name: AWS_SECRET_ACCESS_KEY Value: <Your AWS Secret access key>
- Name: AWS_ACCESS_KEY_ID Value: <Your AWS Access key>
- Name: AWS_DEFAULT_REGION Value: <Your AWS Region>
- Come back to Pipelines -> Settings and click on “Configure bitbucket-pipelines.yml” button
- Scroll down and Select “Other” in the dropdown
- Paste the following in the code in the editor
- Replace the S3 bucket path and click on commit button and watch your pipeline build.
Now every time you push your changes to your repository, BitBucket Pipelines will automatically zip the total source code and upload to Amazon S3 bucket.
A Big Note:- there are a limited number of free build minutes per month depending on the type of account you have.To check your remaining build minutes, Go to Bitbucket settings -> Select Plan details under PLANS AND BILLING
Happy Coding ! 😊
0 comments:
Post a Comment