Skip to content

Commit 0da24a3

Browse files
feat: Adds helm chart name functions
- Replaces Synopsys references with Black Duck
1 parent f4dd402 commit 0da24a3

File tree

12 files changed

+64
-17
lines changed

12 files changed

+64
-17
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175

176176
END OF TERMS AND CONDITIONS
177177

178-
Copyright 2017 Code Dx, Inc
178+
Copyright 2024 Black Duck Software, Inc. All rights reserved.
179179

180180
Licensed under the Apache License, Version 2.0 (the "License");
181181
you may not use this file except in compliance with the License.

functions/docker.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.0.0
33
.GUID fc6ce9ac-58ac-4e50-befb-754f063752f0
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes Docker-related helpers
67
#>
78

functions/helm.ps1

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.3.1
33
.GUID 04273f72-e001-415b-add0-e5e95e378355
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes Helm-related helpers
67
#>
78

@@ -150,6 +151,19 @@ function Get-HelmVersionMajorMinor() {
150151
}
151152

152153
function Get-HelmChartFullname([string] $releaseName, [string] $chartName) {
154+
Get-HelmChartFullnameEquals $releaseName $chartName
155+
}
156+
157+
function Get-HelmChartFullnameContains([string] $releaseName, [string] $chartName) {
158+
159+
$fullname = $releaseName
160+
if (-not ($releaseName.Contains($chartName))) {
161+
$fullname = "$releaseName-$chartName"
162+
}
163+
Get-CommonName $fullname
164+
}
165+
166+
function Get-HelmChartFullnameEquals([string] $releaseName, [string] $chartName) {
153167

154168
$fullname = $releaseName
155169
if ($releaseName -cne $chartName) {
@@ -158,6 +172,10 @@ function Get-HelmChartFullname([string] $releaseName, [string] $chartName) {
158172
Get-CommonName $fullname
159173
}
160174

175+
function Get-HelmChartFullnameConcat([string] $releaseName, [string] $chartName) {
176+
Get-CommonName "$releaseName-$chartName"
177+
}
178+
161179
function Get-CommonName([string] $name) {
162180

163181
# note: matches chart "sanitize" helper
@@ -166,3 +184,12 @@ function Get-CommonName([string] $name) {
166184
}
167185
$name.TrimEnd('-')
168186
}
187+
188+
function Get-AllHelmValues([string] $namespace, [string] $releaseName) {
189+
190+
$values = helm -n $namespace get values $releaseName -a -o json
191+
if ($LASTEXITCODE -ne 0) {
192+
throw "Unable to get release values, helm exited with code $LASTEXITCODE."
193+
}
194+
ConvertFrom-Json $values
195+
}

functions/input.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.0.0
33
.GUID b9a28367-a806-4d33-936c-73f8dc9e522a
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes input-related helpers
67
#>
78

functions/k8s.ps1

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.1.0
33
.GUID bfaf255e-8e7b-4354-824f-46ac9625cab5
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes Kubernetes-related helpers
67
#>
78

@@ -883,6 +884,17 @@ function Get-ServiceAccountName([string] $namespace,
883884
$name
884885
}
885886

887+
function Get-PodLog([string] $namespace,
888+
[string] $containerName,
889+
[string] $podName) {
890+
891+
$log = kubectl -n $namespace logs -c $containerName $podName
892+
if (0 -ne $LASTEXITCODE) {
893+
throw "Unable to get logs for container $containerName and pod $podName, kubectl exited with code $LASTEXITCODE."
894+
}
895+
$log
896+
}
897+
886898
function Set-DeploymentReplicas([string] $namespace,
887899
[string] $resourceName,
888900
[int] $replicaCount,

functions/keytool.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.1.0
33
.GUID d73b9c33-1ca5-40c2-bbce-ff18efd062ab
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes keytool-related helpers
67
#>
78

functions/mariadb.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.1.0
33
.GUID 0bccb44c-14f1-44c0-b41b-3fa02f5bb412
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes MariaDB-related helpers
67
#>
78

functions/resource.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.3.0
33
.GUID 7eadb850-7e43-4308-a9fa-0119a0a883a3
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes resource-related helpers
67
#>
78

functions/step.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.2.0
33
.GUID 30b223d9-c262-4631-9e29-c6ee8191dc26
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes graph-related helpers.
67
#>
78

functions/utils.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<#PSScriptInfo
22
.VERSION 1.1.0
33
.GUID 6d09dd8f-2f19-4e91-9c1a-dfd848e50884
4-
.AUTHOR Code Dx
4+
.AUTHOR Black Duck
5+
.COPYRIGHT Copyright 2024 Black Duck Software, Inc. All rights reserved.
56
.DESCRIPTION Includes utility-related helpers.
67
#>
78

0 commit comments

Comments
 (0)