PSDeploy icon indicating copy to clipboard operation
PSDeploy copied to clipboard

New deployment type: PSGalleryScript

Open RamblingCookieMonster opened this issue 9 years ago • 6 comments

PSGalleryModule is up and running, would be handy to have a PSGalleryScript to go along with it, for example:

Deploy SomeScript {
    By PSGalleryScript {
        FromSource SomeScript.ps1
        To 'PSGallery' #Optional, default to gallery
        WithOptions @{
            ApiKey = '<my_api_key>'
            Guid = '' # Ideally we avoid a new GUID for every deployment... require here or maybe look up in the gallery, generate if not found?
            # Other params, see New-ScriptFileInfo for examples
        }
    }
}

RamblingCookieMonster avatar Jul 16 '16 00:07 RamblingCookieMonster

Do you want to generate the "new-scriptfileinfo" block yourself or have people do that before uploading a script to PSGallery?

Test-ScriptFileInfo and if not generate it?

Plork avatar Jul 18 '16 08:07 Plork

New-ScriptFileInfo and Update-ScriptFileInfo still seem a little dodgy :S so might wanna wait with this module a couple of updates ;)

New-ScriptFileInfo adds all the fields to the scriptfile not just the one you supplied.

Update-ScriptFileInfo does not except any of those fields to be $null even tho they are not mandatory. (does not help if you remove them form the fileinfo block.)

The variable cannot be validated because the value is not a valid value for the CompanyName variable. The variable cannot be validated because the value is not a valid value for the Copyright variable. The variable cannot be validated because the value $null is not a valid value for the RequiredModules variable. The variable cannot be validated because the value $null is not a valid value for the ExternalModuleDependencies variable. The variable cannot be validated because the value $null is not a valid value for the RequiredScripts variable. The variable cannot be validated because the value $null is not a valid value for the ExternalScriptDependencies variable. The variable cannot be validated because the value $null is not a valid value for the Tags variable. The variable cannot be validated because the value $null is not a valid value for the ProjectUri variable. The variable cannot be validated because the value $null is not a valid value for the LicenseUri variable. The variable cannot be validated because the value $null is not a valid value for the IconUri variable. You cannot call a method on a null-valued expression.

Plork avatar Jul 18 '16 08:07 Plork

Yep, those functions definitely have a ways to go. Guessing we'll need two paths:

  • Test-ScriptFileInfo on source passes: Use regex or another tool to update existing manifest (until Update-ScriptFileInfo works)
  • Test-ScriptFileInfo on source fails: Generate header based on WithOptions data.

Personally, I'll always use the latter. Planning to deploy a subset of functions from this misc repo, will let PSDeploy handle the headers, leave the source clean.

Cheers!

RamblingCookieMonster avatar Jul 18 '16 12:07 RamblingCookieMonster

I am planning the latter as well, still in doubt to create folders per script and add a script.test.ps1 and script.psdeploy.ps1 but that's a different matter.

Yeah will need to implement both option for now till MS get's this fixed. Will see what I can do ;)

Plork avatar Jul 18 '16 13:07 Plork

Added a PSGalleryScript type marked as experimental. Definitely needs more work. Not even accounting for Test-ScriptFileInfo yet, at this point assuming all input files are devoid of script info data.

RamblingCookieMonster avatar Jul 24 '16 21:07 RamblingCookieMonster

https://github.com/OneGet/oneget/issues/185

so we need to wait a little while before Update-ScriptFileInfo works

Plork avatar Aug 01 '16 11:08 Plork