Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using the template type 'SimpleModule' it adds unnecessary configuration #277

Closed
johlju opened this issue Apr 25, 2021 · 7 comments · Fixed by #325
Closed

When using the template type 'SimpleModule' it adds unnecessary configuration #277

johlju opened this issue Apr 25, 2021 · 7 comments · Fixed by #325
Labels
enhancement The issue is an enhancement request.

Comments

@johlju
Copy link
Collaborator

johlju commented Apr 25, 2021

When using the template type 'SimpleModule' it should not add:

In RequiredModules.psd1

    'DscResource.Common'        = 'latest'
    'DscResource.Test'          = 'latest'
    'DscResource.AnalyzerRules' = 'latest'
    xDscResourceDesigner        = 'latest'
    'DscResource.DocGenerator'  = 'latest'

In build.yaml

  hqrmtest:
    - DscResource_Tests_Stop_On_Fail

When using the template type 'SimpleModule' it should ask for values for:

In azure-pipelines.yml it should ask for the name of the default branch.

trigger:
  branches:
    include:
    - main

and for

          eq(variables['Build.SourceBranch'], 'refs/heads/master'),

In azure-pipelines.yml it should ask for the name of the account name that owns the upstream repository (so that it does not try to deploy in forks).

        contains(variables['System.TeamFoundationCollectionUri'], 'synedgy')
@johlju
Copy link
Collaborator Author

johlju commented Apr 25, 2021

It should ask if GitVersion should be used and if so add a GitVersion.yaml. and it should ask for the name of the default branch in the line regex: ^main$:

mode: ContinuousDelivery
next-version: 0.0.1
major-version-bump-message: '(breaking\schange|breaking|major)\b'
minor-version-bump-message: '(adds?|features?|minor)\b'
patch-version-bump-message: '\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}'
branches:
  master:
    tag: preview
    regex: ^main$
  pull-request:
    tag: PR
  feature:
    tag: useBranchName
    increment: Minor
    regex: f(eature(s)?)?[\/-]
    source-branches: ['master']
  hotfix:
    tag: fix
    increment: Patch
    regex: (hot)?fix(es)?[\/-]
    source-branches: ['master']

ignore:
  sha: []
merge-message-formats: {}

@johlju
Copy link
Collaborator Author

johlju commented Apr 25, 2021

It should ask for the name of the default branch and add the following to the tasks publishRelease and sendChangelogPR in the pipeline job Deploy_Module. This was fixed in a recent PR.

ReleaseBranch: main
MainGitBranch: main

Example:

          - task: PowerShell@2
            name: publish_release
            displayName: 'Publish Release'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks publish'
              pwsh: true
            env:
              GitHubToken: $(GitHubToken)
              GalleryApiToken: $(GalleryApiToken)
              ReleaseBranch: main
              MainGitBranch: main
          - task: PowerShell@2
            name: send_changelog_PR
            displayName: 'Send CHANGELOG PR'
            inputs:
              filePath: './build.ps1'
              arguments: '-tasks Create_ChangeLog_GitHub_PR'
              pwsh: true
            env:
              GitHubToken: $(GitHubToken)
              ReleaseBranch: main
              MainGitBranch: main

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Apr 25, 2021
@johlju
Copy link
Collaborator Author

johlju commented Apr 28, 2021

The module script file should be empty, it should not use the template which dot-sources a lot of stuff: https://github.com/gaelcolas/Sampler/blob/master/Sampler/Templates/Sampler/module.template

@johlju
Copy link
Collaborator Author

johlju commented Apr 28, 2021

This should either be removed when using SimpleModule (preferably as the template used is 'simple'), or changed to real values (even if it is commented out) not have Sampler/Sampler.psd1 which can be misleading if there is a source folder.

<%
if ($PLASTER_PARAM_ModuleType -ne 'dsccommunity') {
@"
# Path to the Module Manifest to build (where path will be resolved from)
# SourcePath: ./Sampler/Sampler.psd1
# Output Directory where ModuleBuilder will build the Module, relative to module manifest
# OutputDirectory: ../output/Sampler
"@
}
%>

@johlju
Copy link
Collaborator Author

johlju commented May 2, 2021

The build task Publish_GitHub_Wiki_Content must be removed, unless configured correctly.

@johlju
Copy link
Collaborator Author

johlju commented May 3, 2021

Module manifest is not prepared for preview releases. These two are commented.

    PrivateData          = @{
        PSData = @{
            # ReleaseNotes of this module
            ReleaseNotes = ''

            # Prerelease string of this module
            Prerelease = ''
        } # End of PSData hashtable
    } # End of PrivateData hashtable

@johlju
Copy link
Collaborator Author

johlju commented May 3, 2021

Module manifest should be updated to use these:

    # Modules that must be imported into the global environment prior to importing this module
    RequiredModules = @()

    # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
    FunctionsToExport    = @()

    # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
    CmdletsToExport      = @()

    # Variables to export from this module
    VariablesToExport    = @()

    # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
    AliasesToExport      = @()

    # DSC resources to export from this module
    DscResourcesToExport = @()

@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Sep 11, 2021
@gaelcolas gaelcolas mentioned this issue Nov 8, 2021
9 tasks
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant