Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gitlab-runner
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
1,386
Issues
1,386
List
Boards
Labels
Service Desk
Milestones
Merge Requests
184
Merge Requests
184
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GitLab.org
gitlab-runner
Commits
aa06c2b6
Commit
aa06c2b6
authored
Feb 11, 2019
by
Max Wittig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(parallels): move timesync code to separate method
parent
6a94baf7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
executors/parallels/executor_parallels.go
executors/parallels/executor_parallels.go
+21
-12
No files found.
executors/parallels/executor_parallels.go
View file @
aa06c2b6
...
...
@@ -153,6 +153,24 @@ func (s *executor) createVM() error {
return
nil
}
func
(
s
*
executor
)
updateGuestTime
()
error
{
s
.
Debugln
(
"Updating VM date..."
)
timeServer
:=
s
.
Config
.
Parallels
.
TimeServer
if
timeServer
==
""
{
timeServer
=
"time.apple.com"
}
err
:=
prl
.
TryExec
(
s
.
vmName
,
20
,
"sudo"
,
"ntpdate"
,
"-u"
,
timeServer
)
if
err
!=
nil
{
s
.
Debugln
(
"Could not run ntpdate command. Trying the sntp command instead..."
)
err
=
prl
.
TryExec
(
s
.
vmName
,
20
,
"sudo"
,
"sntp"
,
"-S"
,
timeServer
)
if
err
!=
nil
{
return
err
}
}
return
nil
}
func
(
s
*
executor
)
Prepare
(
options
common
.
ExecutorPrepareOptions
)
error
{
err
:=
s
.
AbstractExecutor
.
Prepare
(
options
)
if
err
!=
nil
{
...
...
@@ -264,19 +282,10 @@ func (s *executor) Prepare(options common.ExecutorPrepareOptions) error {
// TODO: integration tests do fail on this due
// Unable to open new session in this virtual machine.
// Make sure the latest version of Parallels Tools is installed in this virtual machine and it has finished booting
s
.
Debugln
(
"Updating VM date..."
)
timeServer
:=
s
.
Config
.
Parallels
.
TimeServer
if
timeServer
==
""
{
timeServer
=
"time.apple.com"
}
err
=
prl
.
TryExec
(
s
.
vmName
,
20
,
"sudo"
,
"ntpdate"
,
"-u"
,
timeServer
)
err
=
s
.
updateGuestTime
()
if
err
!=
nil
{
s
.
Debugln
(
"Could not run ntpdate command. Trying the sntp command instead..."
)
err
=
prl
.
TryExec
(
s
.
vmName
,
20
,
"sudo"
,
"sntp"
,
"-S"
,
timeServer
)
if
err
!=
nil
{
s
.
Println
(
"Could not sync with timeserver!"
)
return
err
}
s
.
Println
(
"Could not sync with timeserver!"
)
return
err
}
ipAddr
,
err
:=
s
.
waitForIPAddress
(
s
.
vmName
,
60
)
...
...
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