Skip to content

Commit f56dd6d

Browse files
authored
Merge pull request #142 from RWS/develop
Develop
2 parents d445c08 + 4e1346d commit f56dd6d

File tree

202 files changed

+12085
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+12085
-133
lines changed

Automation/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update && apt-get --yes install git && apt-get -f install

Automation/Modules/SDLDevTools/0.3/Get-SDLOpenSourceHeader.ps1

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<#
2-
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
3-
#
2+
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
3+
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
7-
#
7+
#
88
# http://www.apache.org/licenses/LICENSE-2.0
9-
#
9+
#
1010
# Unless required by applicable law or agreed to in writing, software
1111
# distributed under the License is distributed on an "AS IS" BASIS,
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,7 +22,7 @@ Function Get-SDLOpenSourceHeader {
2222
)
2323

2424
$header= @"
25-
Copyright (c) 2014 All Rights Reserved by the SDL Group.
25+
Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
2626
2727
Licensed under the Apache License, Version 2.0 (the "License");
2828
you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
3535
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3636
See the License for the specific language governing permissions and
3737
limitations under the License.
38-
"@
38+
"@
3939
$output=$null
4040
switch ($Format)
4141
{

Automation/Modules/SDLDevTools/0.3/Get-SDLOpenSourceHeaderFormat.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#
2-
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
2+
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

Automation/Modules/SDLDevTools/0.3/SDLDevTools.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#
2-
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
2+
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

Automation/Modules/SDLDevTools/0.3/SDLDevTools.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#
2-
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
2+
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

Automation/Modules/SDLDevTools/0.3/Set-SDLOpenSourceHeader.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#
2-
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
2+
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

Automation/Modules/SDLDevTools/0.3/Test-SDLOpenSourceHeader.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<#
2-
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
2+
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env groovy
2+
3+
def pwsh(command) {
4+
println 'About to run pwsh Command'
5+
println '---------------------------------------------------'
6+
println command
7+
println '---------------------------------------------------'
8+
9+
def filename = UUID.randomUUID().toString() + '.ps1'
10+
writeFile file: filename, text: command
11+
// CLIXML output --> https://github.com/PowerShell/PowerShell/issues/5912
12+
sh "pwsh -NonInteractive -NoProfile -OutputFormat Text -Command \" & './${filename}' \""
13+
}
14+
15+
pipeline {
16+
options {
17+
buildDiscarder(logRotator(numToKeepStr: '5'))
18+
durabilityHint('PERFORMANCE_OPTIMIZED')
19+
timeout(time: 1, unit: 'HOURS')
20+
}
21+
22+
agent {
23+
dockerfile {
24+
dir 'Automation'
25+
filename 'Dockerfile'
26+
label 'docker'
27+
args '-u root'
28+
}
29+
}
30+
31+
triggers {
32+
cron('H 2 * * *')
33+
}
34+
35+
parameters {
36+
choice(choices: ['Nexus', 'PSGallery'], description: 'Select the repository the modules should be published to: Nexus(.sdl.com) or PSGallery', name: 'Repository')
37+
}
38+
39+
stages {
40+
stage('Publish the ISHBootstrap Module') {
41+
when {
42+
beforeAgent true
43+
anyOf {
44+
triggeredBy cause: 'UserIdCause';
45+
triggeredBy cause: 'TimerTriggerCause';
46+
}
47+
}
48+
steps {
49+
wrap([$class: 'BuildUser']) {
50+
withCredentials([string(credentialsId: "NexusApiKey", variable: "APIKEY")]) {
51+
pwsh "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; & ./Automation/Publish-ISHBootstrapModule.ps1 -Repository '${params.Repository}'"
52+
}
53+
}
54+
}
55+
}
56+
}
57+
post {
58+
always {
59+
script {
60+
currentBuild.result = currentBuild.result ?: 'SUCCESS'
61+
notifyBitbucket()
62+
}
63+
}
64+
cleanup {
65+
sh 'chmod -R 777 .'
66+
deleteDir()
67+
}
68+
}
69+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<#
2+
.Synopsis
3+
Publish the ISHBootstrap powershell module to one of the supported repositories
4+
.DESCRIPTION
5+
Publish the ISHBootstrap powershell module to one of the supported repositories
6+
#>
7+
[CmdletBinding(SupportsShouldProcess = $true)]
8+
param(
9+
[Parameter(Mandatory = $true)]
10+
[ValidateSet("Nexus", "PSGallery")]
11+
[string]$Repository,
12+
[Parameter(Mandatory = $false)]
13+
[switch]$PreRelease = $false #Future usage, to support pubishing prerelase versions to e.g. PSGallery (and Nexus?)
14+
)
15+
16+
if ($PSBoundParameters['Debug']) {
17+
$DebugPreference = 'Continue'
18+
}
19+
20+
Write-Debug "PSCmdlet.ParameterSetName=$($PSCmdlet.ParameterSetName)"
21+
foreach ($psbp in $PSBoundParameters.GetEnumerator()) { Write-Debug "$($psbp.Key)=$($psbp.Value)" }
22+
23+
$publishModulePath = "$PSScriptRoot"
24+
25+
switch ($Repository) {
26+
"Nexus" {
27+
Write-Host "Register the $Repository repository if needed"
28+
Get-PSRepository -WarningAction SilentlyContinue | Where-Object { $_.Name -eq $Repository } | Unregister-PSRepository
29+
30+
$psRepositoryHashSDLNexus = @{
31+
SourceLocation = "https://nexus.sdl.com/service/local/nuget/releases_powershell/"
32+
PublishLocation = "https://nexus.sdl.com/service/local/nuget/releases_powershell/"
33+
InstallationPolicy = "Trusted"
34+
}
35+
Register-PSRepository @psRepositoryHashSDLNexus -Name $Repository
36+
37+
$RepositoryToPublish = $Repository
38+
$ApiKey = "$env:APIKEY"
39+
40+
# Install the required dependend modules otherwise Test-ModuleManifest fails (https://github.com/PowerShell/PowerShell/issues/7722)
41+
& $publishModulePath/../Source/Builders/Default/Install-ISHBootstrapPrerequisites.ps1 -FTP -ISHVersion 14.0.3
42+
43+
& $publishModulePath/Publish-Module.ps1 -DevRepository $RepositoryToPublish -NuGetApiKey $ApiKey
44+
break
45+
}
46+
"PSGallery" {
47+
# Explicitely set to $null, Publish-Module is executed with -WhatIf (https://jira.sdl.com/browse/SYS-2796)
48+
Write-Warning "Force omitting NuGetApiKey. Publish-Module will be executed with -WhatIf for PSGallery (See SYS-2796)."
49+
#$ApiKey = "$env:APIKEY_DOCS_PSGALLERY"
50+
$ApiKey = $null
51+
# Install the required dependend modules otherwise Test-ModuleManifest fails (https://github.com/PowerShell/PowerShell/issues/7722)
52+
& $publishModulePath/../Source/Builders/Default/Install-ISHBootstrapPrerequisites.ps1 -FTP -ISHVersion 14.0.3
53+
54+
if ($null -eq $ApiKey ) {
55+
& $publishModulePath/Publish-Module.ps1
56+
}
57+
else {
58+
& $publishModulePath/Publish-Module.ps1 -NuGetApiKey $ApiKey
59+
}
60+
break
61+
}
62+
default {
63+
# Should not happen, because of the ValidateSet on the Repository parameter.
64+
throw "Unsupported Repository used: $Repository"
65+
break
66+
}
67+
}

0 commit comments

Comments
 (0)