Create Feature Branch Environment

Create feature branch

The name of the feature is up to you, choose something simple and short, describing what you are doing. For this workshop we are going to change color by simply editing index.html file. To start a feature named change-color you’ll use:

git flow feature start change-color

This will automatically do the following:

  • create a new branch named feature/change-color from the develop branch,
  • checkout the feature/change-color branch So, yes, you’re ready to go! Just hack, commit, push, … You’ This action performs the following:

And you should see something similar to:

Switched to a new branch 'feature/change-color'                                                                                      
.....
.....                                                                                        

Create feature branch environment

The lambda function you created earlier will automatically detect a new branch it will trigger the function to create the environment and code pipeline.

Commit a change and then update your app

In this step, you will revise the sample code and commit the change to your repository. CodePipeline will detect your updated sample code and then automatically initiate AWS CodeBuild to build the source code. CodePipeline then uses Elastic Beanstalk to deploy the build output to the environment.

Edit line:38 in index.html. We are going to change the color from purple to green

screenshot

  1. The git status command displays the state of the working directory and the staging area.

    ConsoleAccess:~/environment/gitflow-workshop (feature/change-color) $ git status      
  2. Run git add to stage the change.

    ConsoleAccess:~/environment/gitflow-workshop (feature/change-color) $ git add -A        
  3. Run git commit to commit the change and push it to feature/change-color branch

    ConsoleAccess:~/environment/gitflow-workshop (feature/change-color) $ git commit -m "Changed Color"    
    ConsoleAccess:~/environment/gitflow-workshop (feature/change-color) $ git push --set-upstream origin feature/change-color

And you should see something similar to:

Counting objects: 3, done.                                                            Compressing objects: 100% (3/3), done.                                                            Writing objects: 100% (3/3), 294 bytes | 294.00 KiB/s, done.                                                            Total 3 (delta 2), reused 0 (delta 0)                                                               To https://git-codecommit.us-east-1.amazonaws.com/v1/repos/gitflow-workshop                                                         * [new branch]      feature/change-color -> feature/change-color                                                            Branch feature/change-color set up to track remote branch feature/change-color from origin.                                          

Amazon CloudWatch Events rule detects source changes it starts the pipeline. To verify your pipeline ran successfully, monitor the progress of the pipeline gitflow-workshop-feature-change-color-pipeline as it moves through each stage by going to CodePipeline Console.

beanstalk-develop-pipeline

After the pipeline ran successfully, go to the environment URL for the gitflow-workshop-changecolor application and the web browser should display the latest changes you made. beanstalk-feature

Manual creation steps

Only run the below step if the lambda trigger is not working

You can manually trigger the creation of the development environment

aws cloudformation create-stack --template-body file://envcreate.yaml --capabilities CAPABILITY_IAM --stack-name gitflow-workshop-changecolor --parameters ParameterKey=Environment,ParameterValue=gitflow-workshop-changecolor ParameterKey=RepositoryName,ParameterValue=gitflow-workshop ParameterKey=BranchName,ParameterValue=feature/change-color