-
Notifications
You must be signed in to change notification settings - Fork 131
Add stepman bin cache #950
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
6ce76c1
to
1eec4f1
Compare
3d824fe
to
949510f
Compare
774e28d
to
57a8bfe
Compare
57a8bfe
to
1d28f2a
Compare
961e22f
to
bec0030
Compare
bec0030
to
3e2cbcc
Compare
toolkits/golang.go
Outdated
@@ -334,6 +334,23 @@ func (toolkit GoToolkit) PrepareForStepRun(step stepmanModels.StepModel, sIDData | |||
return goBuildStep(&defaultRunner{}, goConfig, step.Toolkit.Go.PackageName, stepAbsDirPath, fullStepBinPath) | |||
} | |||
|
|||
func GoBuildStep(stepAbsDirPath string, packageName string, fullStepBinPath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I know we probably won't introduce new toolkits, but I still think this method should be part of the toolkit interface. Offline mode is now a CLI-wide concept, so every toolkit should support it
return nil | ||
} | ||
|
||
compressCmd := command.New("zstd", "--patch-from="+targetExecutablePathLatest, targetExecutablePath, "-o", patchFilePath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not urgent for the prototyping, but we should not forget that this brings a new implicit dependency. I think bitrise setup
should at least check that zstd
is available in $PATH
when the offline mode is enabled.
return checkChecksum(targetExecutablePath, checkSumPath) | ||
} | ||
|
||
func writeChecksum(patchFilePath, checksumPath string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea: SHA256 checksums are not that long when converted to ASCII, so we could also append them to the filenames. This could simplify the code in this file (and also make operations atomic)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspired by the Nix store path format: https://nixos.org/manual/nix/stable/store/store-path
workers = 10 | ||
) | ||
|
||
type GoBuilder func(stepSourceAbsPath, packageName, targetExecutablePath string) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file is heavily coupled with the Go step toolkit while stepman should be neutral. I would rather expend the step toolkit interface with the required methods and hooks to make this code uncoupled from any single toolkit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the idea of expanding the toolkit interface.
However we can not use the toolkit interface here directly, as it would result in circular dependency.
Can look into removing the Go specificness.
8ecef0c
to
b5dfaf9
Compare
eecc865
to
0245219
Compare
324cab6
to
95f7da7
Compare
eeb95a4
to
dfde6d2
Compare
toolkits/golang.go
Outdated
} | ||
|
||
func (toolkit GoToolkit) PrepareForStepRun(step stepmanModels.StepModel, sIDData models.StepIDData, activatedStep stepmanModels.ActivatedStep) (stepmanModels.ActivatedStep, error) { | ||
if activatedStep.Type == stepmanModels.ActivatedStepTypeExecutable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A seperate case if the step is already precompiled.
ActivatedStepTypeExecutable ActivatedStepType = "executable" | ||
) | ||
|
||
type ActivatedStep struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo: still not ideal as can be both source and executable at the same time.
Checklist
README.md
is updated with the changes (if needed)Version
Requires a MAJOR/MINOR/PATCH version update
Context
Changes
Investigation details
Decisions