theohbrothers / PSModulePublisher

A project containing the necessary tools to ease publishing of PowerShell modules.
Apache License 2.0
1 stars 1 forks source link

Docs: Update CI sample files to use newer CI environments and PowerShell 7 #5

Closed joeltimothyoh closed 3 years ago

joeltimothyoh commented 3 years ago

lgtm

leojonathanoh commented 3 years ago

@joeltimothyoh how about using https://hub.docker.com/r/microsoft/powershell/ images directly, and using github workflows? azure pipelines is old

joeltimothyoh commented 3 years ago

Possible, but those are clean images that don't contain packages such as git for resolving of paths of superprojects, or sudo for installation of dependencies in CI environments. @leojonathanoh

leojonathanoh commented 3 years ago

Possible, but those are clean images that don't contain packages such as git for resolving of paths of superprojects

@joeltimothyoh could use https://github.com/theohbrothers/docker-powershell, see some examples https://github.com/theohbrothers/Get-DuplicateItem/blob/v1.1.2/.github/workflows/ci-master-pr.yml#L121

or sudo for installation of dependencies in CI environments. @leojonathanoh

why need sudo? job already running as root

joeltimothyoh commented 3 years ago

why need sudo? job already running as root

sudo was necessary for installing certain packages within containers as the container user in azure-pipelines. I believe container jobs are initialized to run as a user regardless of their pre-configurations. sudo was thus required for running commands such as apt-get. @leojonathanoh

leojonathanoh commented 3 years ago

@joeltimothyoh guess the images should be built with those packages so there would be no need for apt-get in ci jobs

joeltimothyoh commented 3 years ago

@leojonathanoh most of them would likely already exist within the provided VM images. But if steps are run within containers access to those tools would require installation. Could build images to contain those packages. But that adds severe overhead. Besides, PS cmdlets could be used in many ways which could involve any number of package combinations. @leojonathanoh

leojonathanoh commented 3 years ago

@joeltimothyoh e.g. of an external package that PS needs outisde of the PS libraries? I can think of git, ssh (that's covered in PSSession)

joeltimothyoh commented 3 years ago

Or build, test, or publish time dependencies that superprojects require. @leojonathanoh

joeltimothyoh commented 3 years ago

Here's logs from the past demonstrating the need for the sudo package in container jobs on azure-pipelines:

Without sudo

This was an issue in spite of what Initialize containers step logs claim: https://dev.azure.com/startersclan/Compile-SourceScript/_build/results?buildId=205&view=logs&j=6f12d3be-437a-59bf-0616-36fdeef4a6be&t=7f1bce06-ff30-4fc9-af32-50ddb862b235&l=65

With sudo package and invoking sudo

In sum

The docs on container jobs did address some requirements for docker images used in container jobs. The requirements could have changed now: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/container-phases?view=azure-devops. GitLab doesn't seem to have the same issue. Things could have changed for azure-pipelines since. Just a heads-up concerning container jobs and possible need for the sudo package. @leojonathanoh

leojonathanoh commented 3 years ago

@joeltimothyoh move on to github actions might not have such an issue

joeltimothyoh commented 3 years ago

@joeltimothyoh move on to github actions might not have such an issue

I would think so. Never really had a use case for mutating container images other than the above so I don't know. @leojonathanoh

joeltimothyoh commented 3 years ago

The lack of log retention is a serious downside of GHA. @leojonathanoh

leojonathanoh commented 3 years ago

@joeltimothyoh the poor disintegrated azp system is also a pretty major downside