Pipeline Process Scripts


Bash scripts that contains the specific set of actions that will be executed during a specific stage.


Deployment to CodeCommit

git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
git config --global user.email "codepipeline@aws.com"

block "clone repository" do
	mkdir $temp
	cp -rf ./* $temp
	git clone $git_repo git_clone

block "push to repository" do
	cd git_clone
	git checkout $git_branch 
	git pull origin $git_branch
	cp -rf $temp/* ./ 
	git add . 
	git commit -m "Automated Commit by CodePipeline" 
	git push origin $git_branch


Block Sections

block "<block label>" do
	command 1
	command 2

During execution, the codepipeline process each lines as a single command in which it spawn a different instance for each of the commands. Therefore, commands does not have the context made by the lines prior to it. But if the development workflow needs a chain of commands that relies on the context made by the others, block section can be used.

To specify a block section we need the syntax block “<block label>” do and end the block with the endkeyword. The block label is necessary to identify the process properly especially when troubleshooting later on using the log files. This is also used to label the execution during the creation of log entries. All the lines inside the block section will then be transformed into a chained command by inserting the && operator before their execution.