Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Always include docker pipeline in 201 Jenkins template
Browse files Browse the repository at this point in the history
  • Loading branch information
ejizba committed Mar 17, 2017
1 parent 5d4bbeb commit fd840ef
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
43 changes: 15 additions & 28 deletions quickstart_template/201-jenkins-to-azure-container-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ https://github.com/Azure/azure-quickstart-templates/tree/master/201-jenkins-to-a
Command
$0
Arguments
--include_docker_build_pipeline|-i : Include a docker build pipeline (off by default). If enabled, then the rest of the arguments are required
--vm_user_name|-u : VM user name
--git_url|-g : Git URL with a Dockerfile in it's root
--registry|-r : Registry url targeted by the pipeline
--registry_user_name|-ru : Registry user name
--registry_password|-rp : Registry password
--repository|-rr : Repository targeted by the pipeline
--artifacts_location|-al : Url used to reference other scripts/artifacts.
--sas_token|-st : A sas token needed if the artifacts location is private.
--vm_user_name|-u [Required] : VM user name
--git_url|-g [Required] : Git URL with a Dockerfile in it's root
--registry|-r [Required] : Registry url targeted by the pipeline
--registry_user_name|-ru [Required] : Registry user name
--registry_password|-rp [Required] : Registry password
--repository|-rr [Required] : Repository targeted by the pipeline
--artifacts_location|-al : Url used to reference other scripts/artifacts.
--sas_token|-st : A sas token needed if the artifacts location is private.
EOF
}

Expand All @@ -28,7 +27,6 @@ function throw_if_empty() {
}

#defaults
include_docker_build_pipeline="0"
artifacts_location="https://raw.githubusercontent.com/Azure/azure-devops-utils/master/"
while [[ $# > 0 ]]
do
Expand Down Expand Up @@ -59,10 +57,6 @@ do
repository="$1"
shift
;;
--include_docker_build_pipeline|-i)
include_docker_build_pipeline="$1"
shift
;;
--artifacts_location|-al)
artifacts_location="$1"
shift
Expand All @@ -81,14 +75,11 @@ do
esac
done

if [[ "${include_docker_build_pipeline}" == "1" ]]
then
throw_if_empty --vm_user_name $vm_user_name
throw_if_empty --git_url $git_url
throw_if_empty --registry $registry
throw_if_empty --registry_user_name $registry_user_name
throw_if_empty --registry_password $registry_password
fi
throw_if_empty --vm_user_name $vm_user_name
throw_if_empty --git_url $git_url
throw_if_empty --registry $registry
throw_if_empty --registry_user_name $registry_user_name
throw_if_empty --registry_password $registry_password

if [ -z "$repository" ]; then
repository="${vm_user_name}/myfirstapp"
Expand All @@ -112,9 +103,5 @@ sudo gpasswd -a jenkins docker
skill -KILL -u jenkins
sudo service jenkins restart

if [[ "${include_docker_build_pipeline}" == "1" ]]
then
echo "Including the pipeline"

curl --silent "${artifacts_location}/jenkins/add-docker-build-job.sh${artifacts_location_sas_token}" | sudo bash -s -- -j "http://localhost:8080/" -ju "admin" -g "${git_url}" -r "${registry}" -ru "${registry_user_name}" -rp "${registry_password}" -rr "$repository" -sps "* * * * *" -al "$artifacts_location" -st "$artifacts_location_sas_token"
fi
echo "Including the pipeline"
curl --silent "${artifacts_location}/jenkins/add-docker-build-job.sh${artifacts_location_sas_token}" | sudo bash -s -- -j "http://localhost:8080/" -ju "admin" -g "${git_url}" -r "${registry}" -ru "${registry_user_name}" -rp "${registry_password}" -rr "$repository" -sps "* * * * *" -al "$artifacts_location" -st "$artifacts_location_sas_token"
3 changes: 1 addition & 2 deletions quickstart_template/301-jenkins-acr-spinnaker-k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ throw_if_empty --azure_container_registry $azure_container_registry
throw_if_empty --docker_repository $docker_repository
throw_if_empty --pipeline_port $pipeline_port

include_docker_build_pipeline="1"
include_kubernetes_pipeline="1"
pipeline_registry="$azure_container_registry"
front50_port="8081"
Expand All @@ -143,4 +142,4 @@ front50_port="8081"
curl --silent "${artifacts_location}quickstart_template/spinnaker_vm_to_kubernetes.sh${artifacts_location_sas_token}" | sudo bash -s -- -ci "$client_id" -ck "$client_key" -si "$subscription_id" -ti "$tenant_id" -un "$user_name" -rg "$resource_group" -mf "$master_fqdn" -mc "$master_count" -san "$storage_account_name" -sak "$storage_account_key" -acr "$azure_container_registry" -ikp "$include_kubernetes_pipeline" -prg "$pipeline_registry" -prp "$docker_repository" -pp "$pipeline_port" -fp "$front50_port" -al "$artifacts_location" -st "$artifacts_location_sas_token"

# Configure Jenkins
curl --silent "${artifacts_location}quickstart_template/201-jenkins-to-azure-container-registry.sh${artifacts_location_sas_token}" | sudo bash -s -- -i "$include_docker_build_pipeline" -u "$user_name" -g "$git_repository" -r "https://$azure_container_registry" -ru "$client_id" -rp "$client_key" -rr "$docker_repository" -al "$artifacts_location" -st "$artifacts_location_sas_token"
curl --silent "${artifacts_location}quickstart_template/201-jenkins-to-azure-container-registry.sh${artifacts_location_sas_token}" | sudo bash -s -- -u "$user_name" -g "$git_repository" -r "https://$azure_container_registry" -ru "$client_id" -rp "$client_key" -rr "$docker_repository" -al "$artifacts_location" -st "$artifacts_location_sas_token"

0 comments on commit fd840ef

Please sign in to comment.