Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/josh-cooley/choco into d…
Browse files Browse the repository at this point in the history
…evelop

* 'develop' of https://github.com/josh-cooley/choco: (145 commits)
  (maint) Add CODEOWNERS files
  (build) Add templated notifications to all builds
  (build) Add verification of source scripts
  (doc) Further tweak docgen for Chocolatey.PowerShell
  (doc) Tweak docgen for Chocolatey.PowerShell
  (chocolatey#3446) Update GenerateDocs.ps1
  (chocolatey#3307) Do not create Tools directory from MSI
  (maint) Do not create Chocolatey directory in MSI
  (chocolatey#310) Fix path to chocolatey.lib files
  (maint) Corrected casing of file
  (chocolatey#23) Move call to SetRemotePackageNamesIfAllSpecified
  (chocolatey#1901) Revert commit to display location
  (maint) Update Authenticode Signature
  (tests) Some minor tweaks for test consistency
  (chocolatey#310) Set-EnvironmentVariable: delete values properly
  (tests) Remove v2 import tests
  (chocolatey#310) Fix test issues
  (chocolatey#310) Fixup v2 compatibility
  (tests) Working on tests during pairing session
  (chocolatey#2050) Add Pester test for --ignore-pinned option
  ...
  • Loading branch information
josh-cooley committed Jul 8, 2024
2 parents c8f0702 + 3c18060 commit 5e1e5cb
Show file tree
Hide file tree
Showing 436 changed files with 23,545 additions and 6,051 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages.config @chocolatey/chocolatey-credits-reviewers
CREDITS.md @chocolatey/chocolatey-credits-reviewers
/src/chocolatey.resources/tools/ @chocolatey/chocolatey-credits-reviewers
/lib/ @chocolatey/chocolatey-credits-reviewers
103 changes: 91 additions & 12 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ project {
buildType(Chocolatey)
buildType(ChocolateySchd)
buildType(ChocolateyQA)
buildType(ChocolateySign)
buildType(ChocolateyDockerWin)
buildType(ChocolateyPosix)
}
Expand All @@ -21,6 +22,8 @@ object Chocolatey : BuildType({
id = AbsoluteId("Chocolatey")
name = "Chocolatey CLI (Built with Unit Tests)"

templates(AbsoluteId("SlackNotificationTemplate"))

artifactRules = """
""".trimIndent()

Expand Down Expand Up @@ -85,13 +88,16 @@ object Chocolatey : BuildType({

requirements {
doesNotExist("docker.server.version")
doesNotContain("teamcity.agent.name", "Docker")
}
})

object ChocolateySchd : BuildType({
id = AbsoluteId("ChocolateySchd")
name = "Chocolatey CLI (Scheduled Integration Testing)"

templates(AbsoluteId("SlackNotificationTemplate"))

artifactRules = """
""".trimIndent()

Expand Down Expand Up @@ -125,15 +131,10 @@ object ChocolateySchd : BuildType({
}
}

step {
name = "Include Signing Keys"
type = "PrepareSigningEnvironment"
}

script {
name = "Call Cake"
scriptContent = """
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=all --shouldRunOpenCover=false --shouldRunAnalyze=false --shouldRunIlMerge=false --shouldObfuscateOutputAssemblies=false --shouldRunChocolatey=false --shouldRunNuGet=false
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=all --shouldRunOpenCover=false --shouldRunAnalyze=false --shouldRunIlMerge=false --shouldObfuscateOutputAssemblies=false --shouldRunChocolatey=false --shouldRunNuGet=false --shouldAuthenticodeSignMsis=false --shouldAuthenticodeSignOutputAssemblies=false --shouldAuthenticodeSignPowerShellScripts=false
""".trimIndent()
}
}
Expand All @@ -154,13 +155,16 @@ object ChocolateySchd : BuildType({

requirements {
doesNotExist("docker.server.version")
doesNotContain("teamcity.agent.name", "Docker")
}
})

object ChocolateyQA : BuildType({
id = AbsoluteId("ChocolateyQA")
name = "Chocolatey CLI (SonarQube)"

templates(AbsoluteId("SlackNotificationTemplate"))

artifactRules = """
""".trimIndent()

Expand Down Expand Up @@ -195,15 +199,10 @@ object ChocolateyQA : BuildType({
}
}

step {
name = "Include Signing Keys"
type = "PrepareSigningEnvironment"
}

script {
name = "Call Cake"
scriptContent = """
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=none --shouldRunAnalyze=false --shouldRunIlMerge=false --shouldObfuscateOutputAssemblies=false --shouldRunChocolatey=false --shouldRunNuGet=false --shouldRunSonarQube=true --shouldRunDependencyCheck=true
build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=none --shouldRunAnalyze=false --shouldRunIlMerge=false --shouldObfuscateOutputAssemblies=false --shouldRunChocolatey=false --shouldRunNuGet=false --shouldRunSonarQube=true --shouldRunDependencyCheck=true --shouldAuthenticodeSignMsis=false --shouldAuthenticodeSignOutputAssemblies=false --shouldAuthenticodeSignPowerShellScripts=false
""".trimIndent()
}
}
Expand All @@ -225,13 +224,89 @@ object ChocolateyQA : BuildType({

requirements {
doesNotExist("docker.server.version")
doesNotContain("teamcity.agent.name", "Docker")
}
})

object ChocolateySign : BuildType({
id = AbsoluteId("ChocolateySign")
name = "Chocolatey CLI (Script Signing)"

templates(AbsoluteId("SlackNotificationTemplate"))

artifactRules = """
""".trimIndent()

params {
param("env.vcsroot.branch", "%vcsroot.branch%")
param("env.Git_Branch", "%teamcity.build.vcs.branch.Chocolatey_ChocolateyVcsRoot%")
param("env.FORCE_OFFICIAL_AUTHENTICODE_SIGNATURE", "true")
param("teamcity.git.fetchAllHeads", "true")
password("env.GITHUB_PAT", "%system.GitHubPAT%", display = ParameterDisplay.HIDDEN, readOnly = true)
}

vcs {
root(DslContext.settingsRoot)

branchFilter = """
+:*
""".trimIndent()
}

steps {
powerShell {
name = "Prerequisites"
scriptMode = script {
content = """
if ((Get-WindowsFeature -Name NET-Framework-Features).InstallState -ne 'Installed') {
Install-WindowsFeature -Name NET-Framework-Features
}
choco install windows-sdk-7.1 netfx-4.0.3-devpack dotnet-6.0-runtime --confirm --no-progress
exit ${'$'}LastExitCode
""".trimIndent()
}
}

step {
name = "Include Signing Keys"
type = "PrepareSigningEnvironment"
}

script {
name = "Call Cake"
scriptContent = """
build.official.bat --verbosity=diagnostic --target=Sign-PowerShellScripts --exclusive
""".trimIndent()
}
}

triggers {
vcs {
triggerRules = """
+:nuspec/**/*.ps1
+:nuspec/**/*.psm1
+:nuspec/**/*.psd1
+:src/chocolatey.resources/**/*.ps1
+:src/chocolatey.resources/**/*.psm1
+:src/chocolatey.resources/**/*.psd1
""".trimIndent()
branchFilter = "+:develop"
}
}

requirements {
doesNotExist("docker.server.version")
doesNotContain("teamcity.agent.name", "Docker")
}
})

object ChocolateyDockerWin : BuildType({
id = AbsoluteId("ChocolateyDockerWin")
name = "Docker (Windows)"

templates(AbsoluteId("SlackNotificationTemplate"))

params {
// TeamCity has suggested "${Chocolatey.depParamRefs.buildNumber}"
param("env.CHOCOLATEY_VERSION", "%dep.Chocolatey.build.number%")
Expand Down Expand Up @@ -279,13 +354,16 @@ object ChocolateyDockerWin : BuildType({
requirements {
contains("docker.server.osType", "windows")
exists("docker.server.version")
contains("teamcity.agent.name", "Docker")
}
})

object ChocolateyPosix : BuildType({
id = AbsoluteId("ChocolateyPosix")
name = "Docker (Linux)"

templates(AbsoluteId("SlackNotificationTemplate"))

params {
param("env.CAKE_NUGET_SOURCE", "") // The Cake version we use has issues with authing to our private source on Linux
param("env.PRIMARY_NUGET_SOURCE", "") // As above there are issues with authing to our private source on Linux
Expand Down Expand Up @@ -391,5 +469,6 @@ object ChocolateyPosix : BuildType({
requirements {
contains("docker.server.osType", "linux")
exists("docker.server.version")
contains("teamcity.agent.name", "Docker")
}
})
4 changes: 2 additions & 2 deletions .templates/default/issue-note.sbn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{
if issue_label == "Bug" || issue_label == "Bug Fix" || issue_label == "Bug Fixes"
}}- Fix - {{ issue.title }} - see [#{{ issue.number }}]({{ issue.html_url }}).
}}- Fix - {{ issue.title }} - see [#{{ issue.public_number }}]({{ issue.html_url }}).
{{ else
}}- {{ issue.title }} - see [#{{ issue.number }}]({{ issue.html_url }}).
}}- {{ issue.title }} - see [#{{ issue.public_number }}]({{ issue.html_url }}).
{{ end -}}
4 changes: 2 additions & 2 deletions .templates/default/release-info.sbn
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{
if issues.count > 0
if commits.count > 0
}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) being closed.
}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}) which resulted in [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?{{ milestone.query_string }}) being closed.
{{ else
}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?closed=1) closed.
}}As part of this release we had [{{ issues.count }} {{ issues.count | string.pluralize "issue" "issues" }}]({{ milestone.target.html_url }}?{{ milestone.query_string }}) closed.
{{ end
else if commits.count > 0
}}As part of this release we had [{{ commits.count }} {{ commits.count | string.pluralize "commit" "commits" }}]({{ commits.html_url }}).
Expand Down
54 changes: 54 additions & 0 deletions COMMITTERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,57 @@ References

* [http://pivotallabs.com/git-rebase-onto/ (Archive)](https://web.archive.org/web/20150709101404/http://pivotallabs.com:80/git-rebase-onto/)
* http://git-scm.com/book/ch3-6.html

## Generating and Updating Cmdlet Documentation

Documentation for the cmdlets in the Chocolatey.PowerShell project is maintained as `*.md` files in the [chocolatey/docs](https://github.com/chocolatey/docs) repository, under `input/en-us/create/cmdlets`.
When making changes to a cmdlet or adding a new one, we need to ensure that those Markdown files get updated, and that those changes are propagated back to this repository in the [`Chocolatey.PowerShell.dll-help.xml`](./src/Chocolatey.PowerShell/Chocolatey.PowerShell.dll-Help.xml) file in the repository.

Before working with this, be sure to clone the `chocolatey/docs` repository locally.
If your local copy of the docs repository is not located at `../docs` relative to this folder, you will need to specify the `-DocsRepositoryPath` parameter whenever calling the `update-cmdlet-documentation.ps1` script.

### Generating Documentation for a new Cmdlet

Run the `update-cmdlet-documentation.ps1` script with the `-NewCommand` parameter, specifying the name of the cmdlet(s) that you've added:

```powershell
./update-cmdlet-documentation.ps1 -NewCommand Test-NewChocolateyCommand
```

Once this completes, you will get a warning that the documentation template needs to be filled out and the newly-generated documentation file will open in your default editor for `*.md` files.

### Updating Documentation For an Existing Cmdlet

Run the `update-cmdlet-documentation.ps1` script:

```powershell
./update-cmdlet-documentation.ps1
```

### Generating the `Chocolatey.PowerShell.dll-help.xml` External Help Documentation

Once new files have been generated, in the `chocolatey/docs` repository, make any additional changes needed to the files.
Note that these files will need to be compatible both with PlatyPS and the docs repository Markdown formatting.
As such, for new files you will need to sure the additional frontmatter is added.
A complete frontmatter block for these files looks like this:

```md
---
Description: Information on Cmdlet-Name cmdlet
external help file: Chocolatey.PowerShell.dll-Help.xml
Module Name: Chocolatey.PowerShell
online version: https://docs.chocolatey.org/en-us/create/functions/cmdlet-name
Order: 70
schema: 2.0.0
Title: Cmdlet-Name
xref: cmdlet-name
---
```

Some files may also have a `RedirectFrom: [ ... ]` frontmatter entry.
This is not required for new files, but existing files (or files added for a cmdlet that is a rewrite of a pre-existing command) should retain their existing redirects.

Run the `update-cmdlet-documentation.ps1` script once more, and add the changes to the `Chocolatey.PowerShell.dll-help.xml` file to a commit.

Finally, add the changes to a commit on a new branch in the `docs` repository and submit a PR for any changes there as well, alongside the PR to any changes made in this repository.
If you are rewriting a cmdlet from a pre-existing script command, ensure you remove the old documentation file from `input/en-us/create/commands` as well, so that there are no duplicate xrefs.
Loading

0 comments on commit 5e1e5cb

Please sign in to comment.