-n run-docker-container.sh CAT
! 1 # / bin / bash
2
3 Docker PS -a | grep Container SOS-CI-
4 IF [$ == 0?]; // If the presence of the then
5 docker rm -f sos-ci-container // remove container
6 docker rmi sos-ci // delete the image
. 7 Fi
. 8
. 9 echo $ PUBLIC_KEY> gerrit_pub_key
10 echo "the RSA PRIVATE KEY ----- ----- the BEGIN"> gerrit_prvt_key
. 11 echo >> gerrit_prvt_key PRIVATE_KEY, $
12 is echo "the RSA PRIVATE KEY ----- ----- the END" >> gerrit_prvt_key
13 is
14 the chmod 600 gerrit_prvt_key
15 gerrit_pub_key the chmod 600
16
./Set-env-to-vars.sh. 17
18 is
.. 19 Docker Build --no Cache -t-SOS-CI---memory the swap with Dockerfile -1 // create a mirrored in the current directory, - no-cache not cached, the default is false, -t: warehouse name applied to the mirror produced, --memory-swap: a finite value equal to the memory plus swap.
20 is
. 21 is #docker SOS -t-CI Build
22 is
23 is Docker RUN -d --name SOS SOS-CI-CI-Container // run a command in the new vessel, -d: detached mode: runs in the background and the container Print out a new container ID, the default is false. --name: vessel name, last name sos-ci is a mirror.
twenty four
The following script is to replace the role of information such as user name and password in the script.
sos-ci git:(master) cat -n set-env-to-vars.sh
1 #!/bin/bash
2
3 conf_file="sos-ci.yaml"
4 password_file="sos-ci/ansible/password.txt"
5 dockerfile="Dockerfile"
6 creating_template="create-template.sh"
7 creating_sos_vm="create-sos-vm.sh"
8 sos_ci_vars="sos-ci/ansible/group_vars/all.yml"
9
10 f_sed() {
11 sed -i "s|$1|$2|g" $3 > /dev/null 2>&1
12 }
13 set "$conf_file" "$password_file" "$dockerfile" "$creating_template" "$creating_sos_vm" "$sos_ci_vars"// set a shell variable 15 do
14 for i // variables for traversal shell
16 f_sed VSPHERE_HOST_IP $vsphere_host $i
17 f_sed VSPHERE_USER $vsphere_user $i
18 f_sed VSPHERE_PASSWORD $vsphere_password $i
19 f_sed VSPHERE_ESXI $esxi_host $i
20 f_sed VSPHERE_DATACENTER $datacenter $i
21 f_sed VSPHERE_DATASTORE $datastore $i
22 f_sed AWS_ACCESS_KEY $aws_access_key $i
23 f_sed AWS_SECRET_KEY $aws_secret_key $i
24 f_sed AWS_REGION $aws_region $i
25 f_sed INSTANCE_NAME $vm_name $i
26 f_sed TEMPEST_INSTANCE_PASSWORD $template_pass $i
27 f_sed LOCALHOST_PASS $localhost_pass $i
28 f_sed HOME_DIR $sos_ci_home_dir $i
29 f_sed ANSIBLE_DIR $sos_ci_ansible_dir $i
30 f_sed REPO_LOCATION $sos_ci_repo_location $i
31 f_sed LOG_DIR $sos_ci_log_dir $i
32 f_sed STAGE $stage $i
33 f_sed TEST_IT_PATCH_NUM $test_it_patch_num $i
34 done