Skip to content
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

Activate step executable #334

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

ofalvai
Copy link
Contributor

@ofalvai ofalvai commented Aug 27, 2024

No description provided.


"github.com/bitrise-io/go-utils/command"
"github.com/bitrise-io/go-utils/pathutil"
"github.com/bitrise-io/stepman/models"
"github.com/bitrise-io/stepman/stepman"
)

var errStepNotAvailableOfflineMode error = fmt.Errorf("step not available in offline mode")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Inlined this error handling into activateStepSource() because offline mode needs to be reworked for step executables anyway (we only cache the step source now, we'll need to cache the executables themselves)

}

if destinationStepYML != "" {
if err := copyStepYML(stepLibURI, id, version, destinationStepYML); err != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this into both activateStepSource() and activateStepExecutable()

@@ -75,46 +69,6 @@ func queryStep(stepLib models.StepCollectionModel, stepLibURI string, id, versio
return step, version, nil
}

func activateStep(stepLib models.StepCollectionModel, stepLibURI, id, version string, step models.StepModel, log stepman.Logger, isOfflineMode bool) (string, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

➡️ activate_source.go

@@ -138,8 +92,14 @@ func copyStepYML(libraryURL, id, version, dest string) error {
func ListCachedStepVersions(log stepman.Logger, stepLib models.StepCollectionModel, stepLibURI, stepID string) []string {
versions := []models.Semver{}

for version, step := range stepLib.Steps[stepID].Versions {
_, err := activateStep(stepLib, stepLibURI, stepID, version, step, log, true)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was doing a full step activation just to check the error. I replaced this with a proper stepman call

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically it is not a full update, as there is an offline flag set in the last parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, true. The reason I had to replace this is the circular dependency between the activateStep() function that now calls this function.

@ofalvai ofalvai force-pushed the ofalvai/activate-step-executable branch from 210db1e to 3b3418a Compare August 27, 2024 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet