Bitbucket pipelines- different branches on different instances
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I have a flow for my app that I have one instance named as Staging and the other is QA and then there is a Production instance. We create branches from Staging and once verifies, they are then merged into staging, then to QA and then into master once verified completely.
I am new to the pipelines and I want to achieve the below flow
- If some branch is pushed, deployment should take place only on Staging EC2 instance and that branch should be switched
- If some branch is merged into staging, deployment should take place only on Staging
- If Staging is then merged into QA, deployment should take place only on QA
- If some thing is merged into master, deployment should take place only on Production
I am using Bitbucket with AWS CodeDeploy service and repository is hosted on Bitbucket
Currently I am able to deploy the master branch on 1 instance. How can I achieve this?
My appspec.yml is as follows
image: php:7.2.13
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
- sh bitbucket-pipelines-codedeploy.sh
develop:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
custom:
just-test-without-cache:
- step:
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
git amazon-ec2 aws-code-deploy bitbucket-pipelines
add a comment |
I have a flow for my app that I have one instance named as Staging and the other is QA and then there is a Production instance. We create branches from Staging and once verifies, they are then merged into staging, then to QA and then into master once verified completely.
I am new to the pipelines and I want to achieve the below flow
- If some branch is pushed, deployment should take place only on Staging EC2 instance and that branch should be switched
- If some branch is merged into staging, deployment should take place only on Staging
- If Staging is then merged into QA, deployment should take place only on QA
- If some thing is merged into master, deployment should take place only on Production
I am using Bitbucket with AWS CodeDeploy service and repository is hosted on Bitbucket
Currently I am able to deploy the master branch on 1 instance. How can I achieve this?
My appspec.yml is as follows
image: php:7.2.13
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
- sh bitbucket-pipelines-codedeploy.sh
develop:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
custom:
just-test-without-cache:
- step:
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
git amazon-ec2 aws-code-deploy bitbucket-pipelines
add a comment |
I have a flow for my app that I have one instance named as Staging and the other is QA and then there is a Production instance. We create branches from Staging and once verifies, they are then merged into staging, then to QA and then into master once verified completely.
I am new to the pipelines and I want to achieve the below flow
- If some branch is pushed, deployment should take place only on Staging EC2 instance and that branch should be switched
- If some branch is merged into staging, deployment should take place only on Staging
- If Staging is then merged into QA, deployment should take place only on QA
- If some thing is merged into master, deployment should take place only on Production
I am using Bitbucket with AWS CodeDeploy service and repository is hosted on Bitbucket
Currently I am able to deploy the master branch on 1 instance. How can I achieve this?
My appspec.yml is as follows
image: php:7.2.13
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
- sh bitbucket-pipelines-codedeploy.sh
develop:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
custom:
just-test-without-cache:
- step:
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
git amazon-ec2 aws-code-deploy bitbucket-pipelines
I have a flow for my app that I have one instance named as Staging and the other is QA and then there is a Production instance. We create branches from Staging and once verifies, they are then merged into staging, then to QA and then into master once verified completely.
I am new to the pipelines and I want to achieve the below flow
- If some branch is pushed, deployment should take place only on Staging EC2 instance and that branch should be switched
- If some branch is merged into staging, deployment should take place only on Staging
- If Staging is then merged into QA, deployment should take place only on QA
- If some thing is merged into master, deployment should take place only on Production
I am using Bitbucket with AWS CodeDeploy service and repository is hosted on Bitbucket
Currently I am able to deploy the master branch on 1 instance. How can I achieve this?
My appspec.yml is as follows
image: php:7.2.13
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
- sh bitbucket-pipelines-codedeploy.sh
develop:
- step:
caches:
- composer
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
custom:
just-test-without-cache:
- step:
script:
- sh bitbucket-pipelines-common.sh
- vendor/bin/phpunit
git amazon-ec2 aws-code-deploy bitbucket-pipelines
git amazon-ec2 aws-code-deploy bitbucket-pipelines
edited Mar 5 at 11:24
Vadim Kotov
4,85863549
4,85863549
asked Jan 4 at 9:15
baig772baig772
1,47863060
1,47863060
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
If the code deploy script is pulling AWS variables from the environment, you can create a bash script to run before that step that sets the environment variables depending on the branch, i.e.
#!/bin/bash
if [ "$BITBUCKET_BRANCH" = "master" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Development"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "staging" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Staging"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "production" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Production"
export S3_BUCKET=""..."
fi
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54035971%2fbitbucket-pipelines-different-branches-on-different-instances%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If the code deploy script is pulling AWS variables from the environment, you can create a bash script to run before that step that sets the environment variables depending on the branch, i.e.
#!/bin/bash
if [ "$BITBUCKET_BRANCH" = "master" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Development"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "staging" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Staging"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "production" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Production"
export S3_BUCKET=""..."
fi
add a comment |
If the code deploy script is pulling AWS variables from the environment, you can create a bash script to run before that step that sets the environment variables depending on the branch, i.e.
#!/bin/bash
if [ "$BITBUCKET_BRANCH" = "master" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Development"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "staging" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Staging"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "production" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Production"
export S3_BUCKET=""..."
fi
add a comment |
If the code deploy script is pulling AWS variables from the environment, you can create a bash script to run before that step that sets the environment variables depending on the branch, i.e.
#!/bin/bash
if [ "$BITBUCKET_BRANCH" = "master" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Development"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "staging" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Staging"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "production" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Production"
export S3_BUCKET=""..."
fi
If the code deploy script is pulling AWS variables from the environment, you can create a bash script to run before that step that sets the environment variables depending on the branch, i.e.
#!/bin/bash
if [ "$BITBUCKET_BRANCH" = "master" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Development"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "staging" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Staging"
export S3_BUCKET=""..."
elif [ "$BITBUCKET_BRANCH" = "production" ]
then
export APPLICATION_NAME="..."
export DEPLOYMENT_CONFIG="..."
export DEPLOYMENT_GROUP_NAME="Production"
export S3_BUCKET=""..."
fi
answered Jan 21 at 17:03
PeskyGnatPeskyGnat
1,9561316
1,9561316
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54035971%2fbitbucket-pipelines-different-branches-on-different-instances%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown