Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache git credentials in init.sh #203

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions azure/azuredeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"defaultValue": "citustestcluster",
"type": "string"
},
"git_username": {
"type": "securestring"
},
"git_token": {
"type": "securestring"
},
"adminUsername": {
"type": "string",
"defaultValue": "pguser",
Expand Down Expand Up @@ -384,9 +390,10 @@
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"settings": {
"commandToExecute": "[concat('sh init.sh ', copyIndex(), ' ', variables('numberOfInstances'), ' ', variables('storageAcctName'), ' ', listKeys(variables('storageAcctName'),'2017-10-01').keys[0].value, ' ', parameters('branchName'))]",
"commandToExecute": "[concat('sh init.sh ', copyIndex(), ' ', variables('numberOfInstances'), ' ', variables('storageAcctName'), ' ', listKeys(variables('storageAcctName'),'2017-10-01').keys[0].value, ' ', parameters('branchName'), ' ', parameters('git_username'), ' ', parameters('git_token'))]",
"fileUris": [
"https://raw.githubusercontent.com/citusdata/test-automation/master/azure/init.sh"
"https://raw.githubusercontent.com/citusdata/test-automation/master/azure/init.sh",
"https://raw.githubusercontent.com/citusdata/test-automation/master/hammerdb/cache_git_creds.sh"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion azure/create-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ echo "waiting a long time to create cluster, this might take up to 30 mins depen
# so that $HOME, $PATH are set to the target users $HOME and $PATH.
export BRANCH=${CIRCLE_BRANCH:=master}

az group deployment create -g ${rg} --template-file azuredeploy.json --parameters @azuredeploy.parameters.json --parameters sshPublicKey="${public_key}" branchName="$BRANCH"
az group deployment create -g ${rg} --template-file azuredeploy.json --parameters @azuredeploy.parameters.json --parameters sshPublicKey="${public_key}" branchName="$BRANCH" git_username="${GIT_USERNAME}" git_token="${GIT_TOKEN}"

end_time=`date +%s`
echo execution time was `expr $end_time - $start_time` s.
Expand Down
5 changes: 5 additions & 0 deletions azure/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ echo '${TARGET_USER} ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers


BRANCH=$5
export GIT_USERNAME=$6
export GIT_TOKEN=$7

echo ${BRANCH} > /tmp/branch_name

Expand Down Expand Up @@ -166,3 +168,6 @@ find_private_ips() {
}

find_private_ips "$@"

# cache git credentials so that we can clone a private repository with caching enabled
./cache_git_creds.sh