Skip to content

Conversation

@mitchell-as
Copy link
Collaborator

@mitchell-as mitchell-as commented Sep 23, 2024

TaskDX-2943 We support setting up a runtime on the non-windows drive

@mitchell-as
Copy link
Collaborator Author

Test failures are either known or sporadic. They are unrelated to this PR.

@mitchell-as mitchell-as requested a review from Naatan September 23, 2024 21:15
@mitchell-as mitchell-as marked this pull request as ready for review September 23, 2024 21:15
if err != nil {
logging.Debug("Test link creation failed: %v", err)
}
return err == nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please cleanup the source and target.

Comment on lines 151 to 153
if !d.supportsHardLinks {
return d.DeployViaCopy(id, relativeSrc, absoluteDest)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to happen at a higher level. Recall we record how files were deployed in a config file. We'll need to ensure that this config has the correct value also.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where this can happen. The next level up is in setup.go (

cli/pkg/runtime/setup.go

Lines 466 to 477 in 84273fa

if envDef.NeedsTransforms() {
if err := s.depot.DeployViaCopy(id, envDef.InstallDir, s.path); err != nil {
return errs.Wrap(err, "Could not deploy artifact via copy")
}
if err := envDef.ApplyFileTransforms(s.path); err != nil {
return errs.Wrap(err, "Could not apply env transforms")
}
} else {
if err := s.depot.DeployViaLink(id, envDef.InstallDir, s.path); err != nil {
return errs.Wrap(err, "Could not deploy artifact via link")
}
}
), and I'm not sure we want to expose and make setup change its behavior based on whether or not the depot supports hard links -- it feels like an internal implementation issue.

Also, the storage of deployment type in a config file happens in the DeployVia*() methods, so it will have the correct value.

If there is more to do, please advise.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, we're gonna have to hoist this up to setup.go then. The depots only concern is making it happen, setup.go owns the logic of interpreting envdef and invoking the appropriate deployer. We may want to revisit that given all the recent changes, but probably not for this story, unless addressing it in setup.go becomes difficult or creates other challenges.

@mitchell-as mitchell-as requested a review from Naatan September 23, 2024 22:07
Copy link
Contributor

@Naatan Naatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@Naatan Naatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the hardlink detection logic and concerns to setup. Now we have an entanglement in responsibilities between setup and depot.

@mitchell-as mitchell-as requested a review from Naatan September 24, 2024 20:41
Comment on lines 17 to 23
logging.Debug("Determining if hard links are supported for drive associated with '%s'", path)
defer func() {
log := "Yes they are"
if !supported {
log = "No they are not"
}
logging.Debug(log)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logging.Debug("Determining if hard links are supported for drive associated with '%s'", path)
defer func() {
log := "Yes they are"
if !supported {
log = "No they are not"
}
logging.Debug(log)
defer func() {
logging.Debug("Enforcing deployment via copy as hardlinks are not supported")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the verbosity down.

if err := s.depot.DeployViaLink(id, envDef.InstallDir, s.path); err != nil {
return errs.Wrap(err, "Could not deploy artifact via link")
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can drop this and make line 468 read

if envDef.NeedsTransforms() || !s.supportsHardlinks {

The fact that it will run ApplyFileTransforms doesn't matter, since there wouldn't be any to apply. Though for robustness it wouldn't hurt to wrap a conditional around that.

@mitchell-as mitchell-as requested a review from Naatan September 24, 2024 22:06
}
if err := envDef.ApplyFileTransforms(s.path); err != nil {
return errs.Wrap(err, "Could not apply env transforms")
if s.supportsHardLinks {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if s.supportsHardLinks {
if envDef.NeedsTransforms() {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

@mitchell-as
Copy link
Collaborator Author

Maybe this is okay now? Honestly, this PR has gone through so much churn I wouldn't be surprised if I'm still missing something.

@mitchell-as mitchell-as requested a review from Naatan September 25, 2024 06:59
Copy link
Contributor

@Naatan Naatan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got there 😅

@mitchell-as mitchell-as reopened this Sep 25, 2024
@mitchell-as mitchell-as merged commit 51af785 into version/0-46-0-RC1 Sep 25, 2024
@mitchell-as mitchell-as deleted the mitchell/dx-2943 branch September 25, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants