Skip to content

Commit

Permalink
Merge pull request #142 from RWS/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
roshvets authored Nov 23, 2021
2 parents d445c08 + 4e1346d commit f56dd6d
Show file tree
Hide file tree
Showing 202 changed files with 12,085 additions and 133 deletions.
5 changes: 5 additions & 0 deletions Automation/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM mcr.microsoft.com/dotnet/sdk:3.1-bionic

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get --yes install git && apt-get -f install
12 changes: 6 additions & 6 deletions Automation/Modules/SDLDevTools/0.3/Get-SDLOpenSourceHeader.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<#
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
#
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -22,7 +22,7 @@ Function Get-SDLOpenSourceHeader {
)

$header= @"
Copyright (c) 2014 All Rights Reserved by the SDL Group.
Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -35,7 +35,7 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"@
"@
$output=$null
switch ($Format)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion Automation/Modules/SDLDevTools/0.3/SDLDevTools.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion Automation/Modules/SDLDevTools/0.3/SDLDevTools.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#
# Copyright (c) 2014 All Rights Reserved by the SDL Group.
# Copyright (c) 2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
69 changes: 69 additions & 0 deletions Automation/Publish-ISHBootstrapModule.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env groovy

def pwsh(command) {
println 'About to run pwsh Command'
println '---------------------------------------------------'
println command
println '---------------------------------------------------'

def filename = UUID.randomUUID().toString() + '.ps1'
writeFile file: filename, text: command
// CLIXML output --> https://github.com/PowerShell/PowerShell/issues/5912
sh "pwsh -NonInteractive -NoProfile -OutputFormat Text -Command \" & './${filename}' \""
}

pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
durabilityHint('PERFORMANCE_OPTIMIZED')
timeout(time: 1, unit: 'HOURS')
}

agent {
dockerfile {
dir 'Automation'
filename 'Dockerfile'
label 'docker'
args '-u root'
}
}

triggers {
cron('H 2 * * *')
}

parameters {
choice(choices: ['Nexus', 'PSGallery'], description: 'Select the repository the modules should be published to: Nexus(.sdl.com) or PSGallery', name: 'Repository')
}

stages {
stage('Publish the ISHBootstrap Module') {
when {
beforeAgent true
anyOf {
triggeredBy cause: 'UserIdCause';
triggeredBy cause: 'TimerTriggerCause';
}
}
steps {
wrap([$class: 'BuildUser']) {
withCredentials([string(credentialsId: "NexusApiKey", variable: "APIKEY")]) {
pwsh "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; & ./Automation/Publish-ISHBootstrapModule.ps1 -Repository '${params.Repository}'"
}
}
}
}
}
post {
always {
script {
currentBuild.result = currentBuild.result ?: 'SUCCESS'
notifyBitbucket()
}
}
cleanup {
sh 'chmod -R 777 .'
deleteDir()
}
}
}
67 changes: 67 additions & 0 deletions Automation/Publish-ISHBootstrapModule.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<#
.Synopsis
Publish the ISHBootstrap powershell module to one of the supported repositories
.DESCRIPTION
Publish the ISHBootstrap powershell module to one of the supported repositories
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory = $true)]
[ValidateSet("Nexus", "PSGallery")]
[string]$Repository,
[Parameter(Mandatory = $false)]
[switch]$PreRelease = $false #Future usage, to support pubishing prerelase versions to e.g. PSGallery (and Nexus?)
)

if ($PSBoundParameters['Debug']) {
$DebugPreference = 'Continue'
}

Write-Debug "PSCmdlet.ParameterSetName=$($PSCmdlet.ParameterSetName)"
foreach ($psbp in $PSBoundParameters.GetEnumerator()) { Write-Debug "$($psbp.Key)=$($psbp.Value)" }

$publishModulePath = "$PSScriptRoot"

switch ($Repository) {
"Nexus" {
Write-Host "Register the $Repository repository if needed"
Get-PSRepository -WarningAction SilentlyContinue | Where-Object { $_.Name -eq $Repository } | Unregister-PSRepository

$psRepositoryHashSDLNexus = @{
SourceLocation = "https://nexus.sdl.com/service/local/nuget/releases_powershell/"
PublishLocation = "https://nexus.sdl.com/service/local/nuget/releases_powershell/"
InstallationPolicy = "Trusted"
}
Register-PSRepository @psRepositoryHashSDLNexus -Name $Repository

$RepositoryToPublish = $Repository
$ApiKey = "$env:APIKEY"

# Install the required dependend modules otherwise Test-ModuleManifest fails (https://github.com/PowerShell/PowerShell/issues/7722)
& $publishModulePath/../Source/Builders/Default/Install-ISHBootstrapPrerequisites.ps1 -FTP -ISHVersion 14.0.3

& $publishModulePath/Publish-Module.ps1 -DevRepository $RepositoryToPublish -NuGetApiKey $ApiKey
break
}
"PSGallery" {
# Explicitely set to $null, Publish-Module is executed with -WhatIf (https://jira.sdl.com/browse/SYS-2796)
Write-Warning "Force omitting NuGetApiKey. Publish-Module will be executed with -WhatIf for PSGallery (See SYS-2796)."
#$ApiKey = "$env:APIKEY_DOCS_PSGALLERY"
$ApiKey = $null
# Install the required dependend modules otherwise Test-ModuleManifest fails (https://github.com/PowerShell/PowerShell/issues/7722)
& $publishModulePath/../Source/Builders/Default/Install-ISHBootstrapPrerequisites.ps1 -FTP -ISHVersion 14.0.3

if ($null -eq $ApiKey ) {
& $publishModulePath/Publish-Module.ps1
}
else {
& $publishModulePath/Publish-Module.ps1 -NuGetApiKey $ApiKey
}
break
}
default {
# Should not happen, because of the ValidateSet on the Repository parameter.
throw "Unsupported Repository used: $Repository"
break
}
}
Loading

0 comments on commit f56dd6d

Please sign in to comment.