Skip to content

Fallback download URL logic for steps#369

Open
marcell-vida wants to merge 3 commits intomasterfrom
mvida/fallback-storage
Open

Fallback download URL logic for steps#369
marcell-vida wants to merge 3 commits intomasterfrom
mvida/fallback-storage

Conversation

@marcell-vida
Copy link
Copy Markdown
Contributor

No description provided.

const precompiledStepsEnv = "BITRISE_EXPERIMENT_PRECOMPILED_STEPS"
const precompiledStepsDefaultStorage = "https://storage.googleapis.com/bitrise-steplib-storage"
const precompiledStepsPrimaryStorageEnv = "BITRISE_PRECOMPILED_STEPS_PRIMARY_STORAGE"
const precompiledStepsStorageURLsEnv = "BITRISE_PRECOMPILED_STEPS_STORAGE_URLS"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we'll ever change the URL of the backup location (GCS bucket). I think this diff could be simpler if the backup location was hardcoded into this repo, and only the "override" would be coming from the env var.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was mainly thinking about testing the new bucket, where we don't want any fallback options to be used. With this change we could just pass a list with 1 source and it could fail if something is misconfigured.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, that's a good point and I agree

const precompiledStepsDefaultStorage = "https://storage.googleapis.com/bitrise-steplib-storage"
const precompiledStepsPrimaryStorageEnv = "BITRISE_PRECOMPILED_STEPS_PRIMARY_STORAGE"
const precompiledStepsStorageURLsEnv = "BITRISE_PRECOMPILED_STEPS_STORAGE_URLS"
const precompiledStepsPrimaryStorageEnvDeprecated = "BITRISE_PRECOMPILED_STEPS_PRIMARY_STORAGE"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's not used anywhere, we could just kill it. The only external user of these env vars is this: https://github.com/bitrise-io/bitrise-website/blob/54af00872b6a6b690f9ed68945270d0f2436ac2c/components/ci/app/helpers/workflow_helper.rb#L342

}

if err != nil {
log.Warnf("Failed to download from %s: %s\n", url, err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
log.Warnf("Failed to download from %s: %s\n", url, err)
log.Warnf("Failed to download step from %s: %s\n", url, err)

{
name: "With default base URL",
env: map[string]string{},
name: "Override list via env var",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: there is no env var involved in this test at all, we are testing a different layer

Copy link
Copy Markdown
Contributor

@ofalvai ofalvai left a comment

Choose a reason for hiding this comment

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

Just one more simplification idea, then it's ready to merge!

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