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
4824b707
Commit
4824b707
authored
Aug 04, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix timeout
parent
96d915b5
Pipeline
#455
passed with stages
in 14 minutes and 30 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
src/base
src/base
+6
-1
src/prepare.sh
src/prepare.sh
+1
-1
src/run.sh
src/run.sh
+16
-1
No files found.
src/base
View file @
4824b707
...
@@ -4,5 +4,10 @@ currentDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
...
@@ -4,5 +4,10 @@ currentDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
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"
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() {
_get_vm_ip() {
govc vm.info "-dc=$VC_DATACENTER" -json "$VM_ID" | jq .VirtualMachines[0].Guest.IpAddress | sed 's/"//g'
JSON=$(govc vm.info "-dc=$VC_DATACENTER" -json "$VM_ID")
if [ $? -ne 0 ]; then
echo "fail"
else
echo "$JSON" | jq .VirtualMachines[0].Guest.IpAddress | sed 's/"//g'
fi
}
}
src/prepare.sh
View file @
4824b707
...
@@ -18,7 +18,7 @@ echo 'Waiting for VM to get IP'
...
@@ -18,7 +18,7 @@ echo 'Waiting for VM to get IP'
for
i
in
$(
seq
1 30
)
;
do
for
i
in
$(
seq
1 30
)
;
do
VM_IP
=
$(
_get_vm_ip
)
VM_IP
=
$(
_get_vm_ip
)
if
[
-n
"
$VM_IP
"
]
;
then
if
[
[
-n
"
$VM_IP
"
&&
"
$VM_IP
"
-ne
"fail"
]
]
;
then
echo
"VM got IP:
$VM_IP
"
echo
"VM got IP:
$VM_IP
"
break
break
fi
fi
...
...
src/run.sh
View file @
4824b707
...
@@ -5,7 +5,22 @@
...
@@ -5,7 +5,22 @@
currentDir
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null 2>&1
&&
pwd
)
"
currentDir
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null 2>&1
&&
pwd
)
"
source
${
currentDir
}
/base
# Get variables from base script.
source
${
currentDir
}
/base
# Get variables from base script.
VM_IP
=
$(
_get_vm_ip
)
for
i
in
$(
seq
1 30
)
;
do
VM_IP
=
$(
_get_vm_ip
)
if
[[
-n
"
$VM_IP
"
&&
"
$VM_IP
"
-ne
"fail"
]]
;
then
break
fi
if
[
"
$i
"
==
"30"
]
;
then
echo
'Waited 30 seconds for VM to get IP, exiting...'
# Inform GitLab Runner that this is a system failure, so it
# should be retried.
exit
"
$SYSTEM_FAILURE_EXIT_CODE
"
fi
sleep
1s
done
ssh
-T
-i
"
${
currentDir
}
/../ssh/id_rsa"
-o
StrictHostKeyChecking
=
no
"
$VC_SSH_USER
@
$VM_IP
"
"
$VC_SHELL
"
<
"
${
1
}
"
ssh
-T
-i
"
${
currentDir
}
/../ssh/id_rsa"
-o
StrictHostKeyChecking
=
no
"
$VC_SSH_USER
@
$VM_IP
"
"
$VC_SHELL
"
<
"
${
1
}
"
if
[
$?
-ne
0
]
;
then
if
[
$?
-ne
0
]
;
then
...
...
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