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

Feature/support helm in release manager #916

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
29f9635
Enable helm chart rollouts
serverhorror Jun 3, 2022
dd43e49
helm: Enable rollout via MRO
serverhorror Jun 30, 2022
a127123
fix typo
serverhorror Jun 30, 2022
9d9038d
fix main branch integration
serverhorror Jun 30, 2022
195121e
fix the selector
serverhorror Jun 30, 2022
96b0985
fix selector
serverhorror Jun 30, 2022
f9a6c4c
fix selector (remove projectId)
serverhorror Jun 30, 2022
4f5a3a8
fix rollout
serverhorror Jun 30, 2022
aa684da
collect deployment info
serverhorror Jul 1, 2022
0287827
collect deployment info
serverhorror Jul 1, 2022
765058f
collect deployment info
serverhorror Jul 1, 2022
c4c2269
find dep-loyments
serverhorror Jul 1, 2022
141e8b0
fix selector
serverhorror Jul 1, 2022
33410a3
collect resources
serverhorror Jul 1, 2022
04fcfa1
collect resources
serverhorror Jul 1, 2022
a3c143e
do the rollout dance
serverhorror Jul 1, 2022
5411c27
use latest image
serverhorror Jul 1, 2022
cd26d9b
fix typo
serverhorror Jul 1, 2022
d7a901c
pass release-name to helm
serverhorror Jul 1, 2022
7e8c83b
no diff
serverhorror Jul 1, 2022
45524f1
add default flags
serverhorror Jul 1, 2022
1838b57
add targetproject to values - to reuse in charts
clemensutschig Jul 1, 2022
7b79111
add imagenamespace - to it can be reused in the chart
clemensutschig Jul 1, 2022
50c3b83
Add componentId into rolloutstage
clemensutschig Jul 1, 2022
d0e8314
fix openshift service name bug and apply right values
clemensutschig Jul 1, 2022
22659d6
typo on repoId
clemensutschig Jul 1, 2022
efd0606
typo -> context != project
clemensutschig Jul 1, 2022
7abbcbf
def for podData
clemensutschig Jul 1, 2022
ef3a559
debug for null imageUrl
clemensutschig Jul 1, 2022
5508295
add params into deployment info
clemensutschig Jul 4, 2022
1b614fc
further parameterize
clemensutschig Jul 4, 2022
a6cc72f
save deploymentMean
clemensutschig Jul 4, 2022
382b0f6
refactor to read better
clemensutschig Jul 4, 2022
1fc9fe0
gstring fun - tomake deployments later usefull
clemensutschig Jul 4, 2022
3ea5dd5
simplify
clemensutschig Jul 4, 2022
487d92d
dynamically find files
clemensutschig Jul 4, 2022
99f5e9a
dupe findFiles
clemensutschig Jul 4, 2022
0acdc7e
support dynamic helm config
clemensutschig Jul 4, 2022
1f30391
directory.name
clemensutschig Jul 4, 2022
985e17f
add split to get the owning dir
clemensutschig Jul 4, 2022
692c80b
use correct file api
clemensutschig Jul 4, 2022
42ad47e
add split on path
clemensutschig Jul 4, 2022
51c5523
extract the right information
clemensutschig Jul 4, 2022
1429e80
more dynamic helm
clemensutschig Jul 4, 2022
0bd66d6
more helm config
clemensutschig Jul 4, 2022
2634723
repo.id correct setting
clemensutschig Jul 4, 2022
347a42a
map with repo.id
clemensutschig Jul 4, 2022
d4688e0
more cleanup - only finalize is left
clemensutschig Jul 4, 2022
d556bf7
overwrite namespace
clemensutschig Jul 4, 2022
4fe10bf
targetTag
clemensutschig Jul 4, 2022
61a4287
targetTag
clemensutschig Jul 4, 2022
37dea15
typo on helm flags!
clemensutschig Jul 4, 2022
dd88426
flip to original
clemensutschig Jul 4, 2022
673268d
add tailor pieces as well
clemensutschig Jul 4, 2022
9a9ba68
typo - on adding tailorparams
clemensutschig Jul 4, 2022
f2884da
store the right parameters
clemensutschig Jul 5, 2022
fff4768
test with selectors etc from jenkinsfile
clemensutschig Jul 5, 2022
522afe7
typo on helm check
clemensutschig Jul 5, 2022
14c72a4
typo on helm check
clemensutschig Jul 5, 2022
f36f61c
split provided and system injected helmvalues
clemensutschig Jul 5, 2022
b80b4de
typo on declaration
clemensutschig Jul 5, 2022
f11f861
add deploymentmean resurrrection
clemensutschig Jul 5, 2022
8e4097b
debug deploymentmeans
clemensutschig Jul 5, 2022
eda45ae
deployment means for directories
clemensutschig Jul 5, 2022
1345731
get selectors dynamically
clemensutschig Jul 5, 2022
56b2b8f
get selectors dynamically, bugfix on dupe
clemensutschig Jul 5, 2022
56a53e8
fix typo!
clemensutschig Jul 5, 2022
3e0a819
regression on deployments
clemensutschig Jul 5, 2022
344c5d3
deploymentdec
clemensutschig Jul 5, 2022
5c9619e
simplify
clemensutschig Jul 5, 2022
00198b7
more seraching with functionals
clemensutschig Jul 5, 2022
a504f5c
more functional filtering
clemensutschig Jul 5, 2022
8bf4be4
add tailorparams from descriptor
clemensutschig Jul 5, 2022
4f6eec4
add registry and inject
clemensutschig Jul 5, 2022
95f4b57
remove hardcoded charts dir
clemensutschig Jul 5, 2022
559af95
remove hardcoded charts dir, logger
clemensutschig Jul 5, 2022
2efac0c
refactoring into if
clemensutschig Jul 6, 2022
d0bdaf7
doc changes
clemensutschig Jul 6, 2022
abd35af
Fix CodeNarc complaint
serverhorror Jul 19, 2022
74c09a6
Extract Method to decrease indentation
serverhorror Jul 19, 2022
f5b9530
Make CodeNarc happy
serverhorror Jul 19, 2022
f607411
(test) Fix tailor Deployment Test
serverhorror Jul 19, 2022
8289e15
(chore) remove dead code
serverhorror Jul 19, 2022
d1f8a47
(test) Fix helm tests
serverhorror Jul 19, 2022
dd076f0
(aqua) Pass config thru
serverhorror Jul 20, 2022
88fb66e
(aqua) pass config thru
serverhorror Jul 20, 2022
14a719d
(aqua) exclude imported images from built images
serverhorror Jul 20, 2022
185d9af
(aqua) Allow multiple image reports per pipeline run
serverhorror Jul 20, 2022
2000794
(aqua) Allow multiple image reports per pipeline run
serverhorror Jul 20, 2022
9173d26
Initial commit
serverhorror Jul 20, 2022
a9ad979
Fix imports
serverhorror Jul 20, 2022
86c5f3d
Add Options for CopyImageStage
serverhorror Jul 20, 2022
477687c
Add Options for CopyImageStage
serverhorror Jul 20, 2022
05b9d3b
Add Options for CopyImageStage
serverhorror Jul 20, 2022
8974997
disable aqua for now
serverhorror Jul 20, 2022
eacecf8
Better labeling
serverhorror Jul 20, 2022
ab8e41b
Better labeling
serverhorror Jul 20, 2022
56b8fa5
Debug options
serverhorror Jul 20, 2022
cd9f3e3
remove debug log from constructor
serverhorror Jul 20, 2022
2547e63
debug options
serverhorror Jul 20, 2022
51608eb
move to info level for now
serverhorror Jul 20, 2022
c781eaf
add importImageIntoProject method
serverhorror Jul 20, 2022
c247033
Fix No such property: ServiceRegistry
serverhorror Jul 20, 2022
a6e418c
Fix No such property: openShiftService
serverhorror Jul 20, 2022
2e8215b
Fix "No signature of method"
serverhorror Jul 20, 2022
de2b0ba
Pass options thru vars and stage
serverhorror Jul 20, 2022
9486c03
Use componentId instead of resourceName
serverhorror Jul 20, 2022
bd2bff1
Fix options
serverhorror Jul 20, 2022
67fb09a
Fix variable refs
serverhorror Jul 20, 2022
1cb7e7d
Fix var references
serverhorror Jul 20, 2022
7f21e2b
Remove dead code
serverhorror Jul 20, 2022
1a598c6
cleanup internal vars and add docs
serverhorror Jul 20, 2022
ca158b6
Excempt from static type checking
serverhorror Jul 20, 2022
4cee005
add documentation
serverhorror Jul 20, 2022
95e0286
Make CodeNarc happy
serverhorror Jul 20, 2022
f5e2784
update docs
serverhorror Jul 20, 2022
8700c9a
update docs
serverhorror Jul 20, 2022
5a73033
add dynamic env files
clemensutschig Jul 22, 2022
420462a
replace inclusive .
clemensutschig Jul 22, 2022
fdfa904
consistent naming
clemensutschig Jul 22, 2022
a616806
consistent naming, part2
clemensutschig Jul 22, 2022
bcc5b64
merged value files
clemensutschig Jul 22, 2022
a8db46f
avoid groovy list mess
clemensutschig Jul 22, 2022
029a291
copy by value, not ref assign
clemensutschig Jul 22, 2022
2236fac
codeNArc
clemensutschig Jul 22, 2022
af6edb2
fix test
clemensutschig Jul 22, 2022
30d715e
update docs
serverhorror Jul 22, 2022
bddc2a8
add BASIC helm secret support, similar to tailor
clemensutschig Jul 25, 2022
d5d80f4
add --three-way-merge to the diff invocation
serverhorror Jul 25, 2022
9f8169d
Groovy needs parenthesis
serverhorror Jul 25, 2022
704c9ea
add --three-way-merge to the diff invocation
serverhorror Jul 25, 2022
cbe18fa
ignore unknown diff flags
serverhorror Jul 25, 2022
4e60bd9
ignore unknown diff flags
serverhorror Jul 25, 2022
8c00380
Add `docs` target as I mistype that too often
serverhorror Jul 25, 2022
d244bfd
add --three-way-merge to the diff invocation
serverhorror Jul 25, 2022
dc4f480
Document labelling behaviour
serverhorror Jul 25, 2022
4e07ea7
Use returnStatus, add label, remove unnecessary try/catch
serverhorror Jul 26, 2022
729b2da
Add source image name name to stageLabel
serverhorror Jul 26, 2022
35cc644
Add source image name name to stageLabel
serverhorror Jul 26, 2022
c496ac0
fix logging output
serverhorror Jul 26, 2022
8b1b068
Add source image name name to stageLabel
serverhorror Jul 26, 2022
7d171e5
verify TLS
serverhorror Jul 26, 2022
4001029
Revert "verify TLS"
serverhorror Jul 26, 2022
3a80ce7
Shorter and nicer stageLabel
serverhorror Jul 26, 2022
bd8bd9b
Make CodeNarc HAPPY
serverhorror Jul 27, 2022
59f063b
Make CodeNarc HAPPY
serverhorror Jul 27, 2022
24a90e6
Allow to ignore certificate paths
serverhorror Jul 27, 2022
cde96ce
Allow to ignore certificate paths
serverhorror Jul 27, 2022
75d5974
Fix defaults for verifyTLS
serverhorror Jul 27, 2022
f1d4dc1
Initial version
serverhorror Jul 27, 2022
7062b6c
Move shell step to its own function
serverhorror Jul 28, 2022
32f08ed
Add test cases for copyImage stage
serverhorror Jul 28, 2022
8cbb735
Add missing newline
serverhorror Jul 28, 2022
235cf13
Remove unnecessary test restrictions
serverhorror Jul 28, 2022
8294326
Check if data returned is what we expect
serverhorror Jul 28, 2022
5ab9415
Enhance docs for helmEnvBasedValuesFiles
serverhorror Jul 28, 2022
c418069
Set CopyImageOptions private
serverhorror Aug 16, 2022
c452184
Clarify steps via comments
serverhorror Aug 18, 2022
5e593ce
Implement Helm-/TailorDeploymentStrategies
serverhorror Aug 23, 2022
3a9795d
Update metadata when running in via HelmDeploymentStrategy
serverhorror Aug 29, 2022
b853e2f
Implement Helm-/TailorDeploymentStrategies
serverhorror Aug 29, 2022
824baf3
OpenShiftResourceMetadata.updateMetadata breaks on certain existing l…
serverhorror Aug 29, 2022
265e086
add debug statements
serverhorror Aug 29, 2022
4b87dd0
Remove remnants of Helm from TailorDeploymentStrategy
serverhorror Aug 29, 2022
ed140b3
fix bulkResume in TailorDeploymentStrategy.rollout
serverhorror Aug 29, 2022
5f3321e
debug rolloutdata and document type creation problem
serverhorror Sep 1, 2022
b5f1462
Update metadata to fail initially
serverhorror Sep 1, 2022
3e0e690
Label resources *deployed* via Helm
serverhorror Sep 2, 2022
50a7a24
Make CodeNarc happy
serverhorror Sep 2, 2022
20eb3fe
Fix casing
serverhorror Sep 2, 2022
58088a5
Revert "Label resources *deployed* via Helm"
serverhorror Sep 2, 2022
c4b161d
Remove all labeling from HelmDeploymentStrategy
serverhorror Sep 2, 2022
b8b3a73
Fail helm upgrade based on returnStatus
serverhorror Sep 9, 2022
79c0cdc
push changes to PR
serverhorror Sep 12, 2022
e1d36dc
Test helm failure based on return status
serverhorror Sep 12, 2022
ff4b32c
Debug "mandatory" metadata
serverhorror Sep 13, 2022
6c86e93
Fix missing import, fix var declaration
serverhorror Sep 13, 2022
4907f05
Label rollout resources, debug metadata
serverhorror Sep 13, 2022
6e65b8b
Label rollout resources, debug metadata
serverhorror Sep 13, 2022
1b35830
Debug resources to label
serverhorror Sep 13, 2022
1407926
Debug resources to label
serverhorror Sep 13, 2022
94216d2
Debug resources to label
serverhorror Sep 13, 2022
bea182a
Extract method
serverhorror Sep 13, 2022
6f2ec3d
Label resources separately
serverhorror Sep 13, 2022
ce11640
Add all BUILD_ env variables to extensionImageLabels
serverhorror Sep 13, 2022
24507fa
HelmDeploymentStrategy: info with debug level
serverhorror Sep 19, 2022
c86403f
HelmDeploymentStrategy: test deploymentMeans
serverhorror Sep 19, 2022
28215be
HelmDeploymentStrategy: add strictEntries from Metadata
serverhorror Sep 19, 2022
9db3a5c
Make CodeNarc happy
serverhorror Sep 19, 2022
06bc469
remove unnecessary logic check
serverhorror Nov 2, 2022
b9d2885
add suggestions from opendevstack/ods-pipeline#609
serverhorror Nov 2, 2022
d91ffc7
Fix typo in test
serverhorror Nov 2, 2022
2c4fde0
Merge remote-tracking branch 'upstream/master' into feature/support-h…
serverhorror Nov 9, 2022
e91b5e7
New version 5.x preview
jafarre-bi Nov 10, 2022
fc15a8d
Merge remote-tracking branch 'upstream/master' into feature/support-h…
serverhorror Nov 17, 2022
50bbcc4
Merge remote-tracking branch 'upstream/master' into feature/support-h…
serverhorror Nov 17, 2022
3927a21
Remove dead code
serverhorror Nov 17, 2022
9ab8ca9
Remove dead code
serverhorror Nov 18, 2022
434b495
Remove empty line
serverhorror Nov 18, 2022
0ed9221
Remove dead code
serverhorror Nov 23, 2022
fda6594
Rename method to better reflect what it does
serverhorror Nov 23, 2022
485271d
Fix failing test
serverhorror Nov 23, 2022
ae25709
Detailed exitCode prevents to deploy from scratch
serverhorror Nov 24, 2022
ad3aeb1
Fix parameter dupliation of tailorParams
serverhorror Nov 25, 2022
154c11b
Fix types for call to OpenShift.tailorApply(...)
serverhorror Nov 25, 2022
10725c8
Merge remote-tracking branch 'upstream/master' into feature/support-h…
serverhorror Nov 30, 2022
86191be
Use same paths as ScanWithSonarStage
serverhorror Dec 13, 2022
c07a148
Use same paths as ScanWithSonarStage
serverhorror Dec 13, 2022
b375544
Use same paths as ScanWithSonarStage
serverhorror Dec 13, 2022
c3cc1e1
Use same paths as ScanWithSonarStage
serverhorror Dec 13, 2022
78d55ed
Revert "inheritedConfig", that was stoopid[sic!]
serverhorror Dec 13, 2022
0b15770
update docs
serverhorror Dec 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Add Helm Support to Release Manager ([#866](https://github.com/opendevstack/ods-jenkins-shared-library/issues/866))

## [4.1] - 2022-11-17

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ test:
doc:
./gradlew groovydoc
go run render-adoc.go

.PHONY: docs
docs: doc
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ include::partial$odsComponentStageRolloutOpenShiftDeployment.adoc[leveloffset=+2
=== odsComponentStageUploadToNexus

include::partial$odsComponentStageUploadToNexus.adoc[leveloffset=+2]

=== odsComponentStageCopyImage

include::partial$odsComponentStageCopyImage.adoc[leveloffset=+2]
11 changes: 9 additions & 2 deletions docs/modules/jenkins-shared-library/pages/labelling.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
= OpenShift resource labelling
= OpenShift resource labelling with tailor

== Overview
When a rollout happens via tailor there are labels that are added regardless of whether they are in any template or not.
This is in contrast to helm which relies on the charts setting the right labels.
This decision avoids an unexpected pause or resume during a rollout.
A helm rollout will have only the labels that were specified and OpenDevStack will not try to add, remove or change any labels.
If your cluster has operators there could still be some label changes.


== Overview of tailor labels

The shared library automatically labels all OpenShift resources created in order to ease their management.
The labels applied are based on the recommendations by:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Document generated by render-adoc.go from odsComponentStageCopyImage.adoc.tmpl; DO NOT EDIT.

Copies a source image into the project.

This is useful to get images into the OpenShift registry so that release manager will accept all images.

The primary intention is for helm charts so that external images can be imported.

== Options

[cols="1,2"]
|===
| Option | Description


| *branch* +
_String_
|Branch to run stage for.
Example: `'master'`.
Next to exact matches, it also supports prefixes (e.g. `feature/`) and all branches (`*`).


| *branches* +
_List<String>_
|Branches to run stage for.
Example: `['master', 'develop']`.
Next to exact matches, it also supports prefixes (e.g. `feature/`) and all branches (`*`).


| *sourceCredential* +
_String_
|sourceCredential is the token to use, if any, to access the source registry


| *sourceImageUrlIncludingRegistry* +
_String_
|Source image to import

This needs to be in the following format: [REGISTRY/]REPO/IMAGE[:TAG]


| *tagIntoTargetEnv* +
_Boolean_
|true will tag the image from the -cd namespace into the targetEnvironment that the pipeline is running for


| *verifyTLS* +
_Boolean_
|verifyTLS allows the stage to ignore certificate validation errors.

The default is to verify certificate paths

|===
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copies a source image into the project.

This is useful to get images into the OpenShift registry so that release manager will accept all images.

The primary intention is for helm charts so that external images can be imported.

== Options

[cols="1,2"]
|===
| Option | Description
{{range .Options}}

| *{{.Name}}* +
_{{.Type}}_
|{{.Description}}
{{end}}
|===
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ _boolean_
referenced by `chartDir` exists.


| *helmEnvBasedValuesFiles* +
_List<String>_
|List of paths to values files (empty by default). Only relevant if the
directory referenced by `chartDir` exists.
These must contain a suffix called '.env.yml' - which will be replaced
during rollout and deployment, and then added to helmValueFiles

Passing a string literal of 'values.env.yaml' will be expanded to their respective environments.

For example: 'values.env.yaml' will become 'values.dev.yaml', 'values.test.yaml' or 'values.prod.yaml'.
That means creating the usual files that are named after their respective environment are parsed as usual.


| *helmPrivateKeyCredentialsId* +
_String_
|Credentials name of the private key used by helm-secrets (defaults to
Expand Down Expand Up @@ -158,6 +171,10 @@ _boolean_

|===

All the created or updated OpenShift resources are automatically labeled to ease their management.
== Differences between tailor and helm deployments

When tailor does the rollout, all the created or updated OpenShift resources are automatically labeled to ease their management.
This is in contrast to helm rollouts which rely on the chart providing the desired labels.
Add labels either via the chart directly or via supplying them in the values or values files.

Detailed information about the labelling can be found xref:jenkins-shared-library:labelling.adoc[here].
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ _{{.Type}}_
{{end}}
|===

All the created or updated OpenShift resources are automatically labeled to ease their management.
== Differences between tailor and helm deployments

When tailor does the rollout, all the created or updated OpenShift resources are automatically labeled to ease their management.
This is in contrast to helm rollouts which rely on the chart providing the desired labels.
Add labels either via the chart directly or via supplying them in the values or values files.

Detailed information about the labelling can be found xref:jenkins-shared-library:labelling.adoc[here].
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,12 @@ _boolean_
|Whether to fail the build if the quality gate defined in the SonarQube
project is not reached. Defaults to `false`.


| *resourceName* +
_String_
|Name of `BuildConfig`/`ImageStream` of the image that we want to scan (defaults to `context.componentId`).
BuildOpenShiftImageStage puts the imageRef into a map with the `resourceName` as key.
In order to be able to receive the imageRef for scanning, the `resourceName` needs
to be the same as in BuildOpenShiftImageStage.

|===
55 changes: 55 additions & 0 deletions src/org/ods/component/AbstractDeploymentStrategy.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package org.ods.component

import groovy.transform.TypeChecked
import groovy.transform.TypeCheckingMode
import org.ods.services.OpenShiftService
import org.ods.util.PodData

abstract class AbstractDeploymentStrategy implements IDeploymentStrategy {

protected final List<String> DEPLOYMENT_KINDS = [
OpenShiftService.DEPLOYMENT_KIND, OpenShiftService.DEPLOYMENTCONFIG_KIND,
]

@Override
abstract Map<String, List<PodData>> deploy()

protected Map<String, Map<String, Integer>> fetchOriginalVersions(Map<String, List<String>> deploymentResources) {
def originalVersions = [:]
deploymentResources.each { resourceKind, resourceNames ->
if (!originalVersions.containsKey(resourceKind)) {
originalVersions[resourceKind] = [:]
}
resourceNames.each { resourceName ->
originalVersions[resourceKind][resourceName] = openShift.getRevision(
context.targetProject, resourceKind, resourceName
)
}
}
originalVersions
}

protected findOrCreateImageStream(String targetProject, String image) {
try {
openShift.findOrCreateImageStream(targetProject, image)
} catch (Exception ex) {
steps.error "Could not find/create ImageStream ${image} in ${targetProject}. Error was: ${ex}"
}
}

protected void retagImages(String targetProject, Set<String> images) {
images.each { image ->
findOrCreateImageStream(targetProject, image)
openShift.importImageTagFromProject(
targetProject, image, context.cdProject, options.imageTag, options.imageTag
)
}
}

@TypeChecked(TypeCheckingMode.SKIP)
protected Set<String> getBuiltImages() {
context.buildArtifactURIs.builds.keySet().findAll { it ->
!it.startsWith("imported-")
}
}
}
8 changes: 8 additions & 0 deletions src/org/ods/component/Context.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class Context implements IContext {
config.buildUrl = script.env.BUILD_URL
config.buildTag = script.env.BUILD_TAG
config.buildTime = new Date()
config.dockerRegistry = script.env.DOCKER_REGISTRY
config.openshiftHost = script.env.OPENSHIFT_API_URL
config << BitbucketService.readConfigFromEnv(script.env)
config << NexusService.readConfigFromEnv(script.env)
Expand All @@ -86,6 +87,8 @@ class Context implements IContext {
config.globalExtensionImageLabels = getExtensionBuildParams()
config.globalExtensionImageLabels.putAll(getEnvParamsAndAddPrefix('OPENSHIFT_BUILD',
'JENKINS_MASTER_'))
config.globalExtensionImageLabels.putAll(getEnvParamsAndAddPrefix('BUILD_',
''))

logger.debug("Got external build labels: ${config.globalExtensionImageLabels}")

Expand Down Expand Up @@ -614,6 +617,11 @@ class Context implements IContext {
config.commitGitWorkingTree
}

@NonCPS
String getClusterRegistryAddress () {
config.dockerRegistry
}

private String retrieveGitUrl() {
def gitUrl = script.sh(
returnStdout: true,
Expand Down
40 changes: 40 additions & 0 deletions src/org/ods/component/CopyImageOptions.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.ods.component

import groovy.transform.TypeChecked

@TypeChecked
class CopyImageOptions extends Options {

/**
* Source image to import
*
* This needs to be in the following format: [REGISTRY/]REPO/IMAGE[:TAG]
*/
String sourceImageUrlIncludingRegistry

/**
* true will tag the image from the -cd namespace into the targetEnvironment that the pipeline is running for
*/
Boolean tagIntoTargetEnv

/**
* sourceCredential is the token to use, if any, to access the source registry
*/
String sourceCredential

/**
* verifyTLS allows the stage to ignore certificate validation errors.
*
* The default is to verify certificate paths
*/
Boolean verifyTLS

@SuppressWarnings('UnusedPrivateField')
private String registry
@SuppressWarnings('UnusedPrivateField')
private String repo
@SuppressWarnings('UnusedPrivateField')
private String image
@SuppressWarnings('UnusedPrivateField')
private String imageTag
}
Loading