Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gitlab-runner-vcenter-executor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gitlab-runner-vcenter-executor
Commits
9847f33b
Commit
9847f33b
authored
Jul 08, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use built-in envs
parent
879ec8d7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
8 additions
and
20 deletions
+8
-20
.dockerignore
.dockerignore
+3
-1
.gitignore
.gitignore
+0
-1
config.example
config.example
+0
-13
src/base
src/base
+1
-1
src/cleanup.sh
src/cleanup.sh
+1
-1
src/prepare.sh
src/prepare.sh
+2
-2
src/run.sh
src/run.sh
+1
-1
No files found.
.dockerignore
View file @
9847f33b
/ssh
/config
.git*
Dockerfile
config.example
README.md
LICENSE
.gitignore
View file @
9847f33b
/ssh
/config
config.example
deleted
100644 → 0
View file @
879ec8d7
export GOVC_USERNAME=administrator@example.com
export GOVC_PASSWORD=password_here
export GOVC_URL=vc.example.com
export DATACENTER=example
export VC_HOST=host.example.com
export RESOURCE_POOL=example
export DATASTORE=example-datastore1
export NETWORK=example-runners
export TEMPLATE=runner-template-example
export CPU_COUNT=2
export MEM_COUNT=4096
export SSH_USER=root
src/base
View file @
9847f33b
...
...
@@ -6,5 +6,5 @@ source ${currentDir}/../config # config file
VM_ID="runner-$CUSTOM_ENV_CI_RUNNER_ID-project-$CUSTOM_ENV_CI_PROJECT_ID-concurrent-$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID-job-$CUSTOM_ENV_CI_JOB_ID"
_get_vm_ip() {
govc vm.info "-dc=$DATACENTER" -json "$VM_ID" | jq .VirtualMachines[0].Guest.IpAddress | sed 's/"//g'
govc vm.info "-dc=$
VC_
DATACENTER" -json "$VM_ID" | jq .VirtualMachines[0].Guest.IpAddress | sed 's/"//g'
}
src/cleanup.sh
View file @
9847f33b
...
...
@@ -8,4 +8,4 @@ source ${currentDir}/base # Get variables from base script.
set
-eo
pipefail
# Destroy VM.
govc vm.destroy
"-dc=
$DATACENTER
"
"
$VM_ID
"
govc vm.destroy
"-dc=
$
VC_
DATACENTER
"
"
$VM_ID
"
src/prepare.sh
View file @
9847f33b
...
...
@@ -11,7 +11,7 @@ set -eo pipefail
trap
"exit
$SYSTEM_FAILURE_EXIT_CODE
"
ERR
# Install the VM
govc vm.clone
"-dc=
$
DATACENTER
"
-on
=
true
-waitip
=
true
"-vm=
$TEMPLATE
"
"-host=
$VC_HOST
"
"-pool=
$RESOURCE_POOL
"
"-ds=
$DATASTORE
"
"-net=
$NETWORK
"
"-c=
$CPU_COUNT
"
"-m=
$MEM_COUNT
"
"
$VM_ID
"
govc vm.clone
"-dc=
$
VC_DATACENTER
"
-on
=
true
-waitip
=
true
"-vm=
$VC_TEMPLATE
"
"-host=
$VC_HOST
"
"-pool=
$VC_RESOURCE_POOL
"
"-ds=
$VC_DATASTORE
"
"-net=
$VC_NETWORK
"
"-c=
$VC_CPUS
"
"-m=
$VC_MEMS
"
"
$VM_ID
"
# Wait for VM to get IP
echo
'Waiting for VM to get IP'
...
...
@@ -36,7 +36,7 @@ done
# Wait for ssh to become available
echo
"Waiting for sshd to be available"
for
i
in
$(
seq
1 30
)
;
do
if
ssh
-i
"
${
currentDir
}
/../ssh/id_rsa"
-o
StrictHostKeyChecking
=
no
"
$SSH_USER
@
$VM_IP
"
>
/dev/null 2>/dev/null
;
then
if
ssh
-i
"
${
currentDir
}
/../ssh/id_rsa"
-o
StrictHostKeyChecking
=
no
"
$
VC_
SSH_USER
@
$VM_IP
"
>
/dev/null 2>/dev/null
;
then
break
fi
...
...
src/run.sh
View file @
9847f33b
...
...
@@ -7,7 +7,7 @@ source ${currentDir}/base # Get variables from base script.
VM_IP
=
$(
_get_vm_ip
)
ssh
-i
"
${
currentDir
}
/../ssh/id_rsa"
-o
StrictHostKeyChecking
=
no
"
$SSH_USER
@
$VM_IP
"
/bin/bash <
"
${
1
}
"
ssh
-i
"
${
currentDir
}
/../ssh/id_rsa"
-o
StrictHostKeyChecking
=
no
"
$
VC_
SSH_USER
@
$VM_IP
"
/bin/bash <
"
${
1
}
"
if
[
$?
-ne
0
]
;
then
# Exit using the variable, to make the build as failure in GitLab
# CI.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment