Skip to content

Commit

Permalink
Pipeline CPS method mismatch: - Turn contextContains method into @Non…
Browse files Browse the repository at this point in the history
…CPS , - fix bug with dieIfNotWithin which does the opposite check
  • Loading branch information
akram committed Aug 9, 2019
1 parent 7e54338 commit d84e293
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ openshift-client.iml
.classpath
.project
.settings
.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class OpenShiftDSL implements Serializable {
ContextId(String name) {
this.@name = name;
}
@NonCPS
public String toString() {
return name;
}
Expand Down Expand Up @@ -137,6 +138,7 @@ class OpenShiftDSL implements Serializable {
}
}

@NonCPS
public ContextId getContextId() {
return this.@id;
}
Expand Down Expand Up @@ -236,6 +238,7 @@ class OpenShiftDSL implements Serializable {
/**
* Returns true if the test context identifier is found within the context
*/
@NonCPS
private boolean contextContains(Context context, ContextId test) {
while (context != null) {
if (context.getContextId() == test) {
Expand Down Expand Up @@ -267,7 +270,7 @@ class OpenShiftDSL implements Serializable {

@NonCPS
private void dieIfNotWithin(ContextId me, Context context, ContextId required) throws AbortException {
if (contextContains(context, required)) {
if (!contextContains(context, required)) {
throw new AbortException(me.toString() + " can only be used within a " + required.toString() + " closure body");
}
}
Expand Down

0 comments on commit d84e293

Please sign in to comment.