Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

au_GalleryUrl does not work with Update-AUPackages #254

Closed
danmetzler opened this issue Dec 18, 2021 · 3 comments · Fixed by #256
Closed

au_GalleryUrl does not work with Update-AUPackages #254

danmetzler opened this issue Dec 18, 2021 · 3 comments · Fixed by #256

Comments

@danmetzler
Copy link
Contributor

danmetzler commented Dec 18, 2021

While working on #250, I discovered that $au_GalleryUrl is implemented as a variable in the logic of Update-Package, but it is not implemented as a parameter or environment variable anywhere else.

  • The assumption is it will be passed in as a global variable that Update-Package consumes.
  • Update-AUPackages calls Update-Package inside of a job, using Start-Job.
  • Start-Job creates a new session, so global variables that exist in the session that runs Update-AUPackages are not available to Update-Package

A work around is that we can set the global variable in every update.ps1 script of each package, but this doesn't feel like the way it was intended.

@danmetzler
Copy link
Contributor Author

I'm thinking this might work better if $au_GalleryUrl, or its replacement $au_GalleryPackageRootUrl (#250), were also implemented as part of the $Options parameter for Update-AUPackages.

  • Logic already exists to pass the $Options into the job that calls Update-Package.
  • Update-Package could then have logic to set the global variable if $Options.GalleryPackageRootUrl exists.

There may be other ways to address this, but that's one option that should work.

@danmetzler
Copy link
Contributor Author

While thinking about this, just a side comment. I see data passed into Update-AUPackages and Update-Package using parameters, global variables set outside the AU module code, and environment variables. It seems like some things are available as an environment varirable, and others aren't. Is there a strategy around when something is implemented as global variable vs environment variable vs parameter vs combination of those?

@majkinetor
Copy link
Owner

No particular strategy. Just organic growth. Should be env vars.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants