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

refactor(dependency): replace groovy coordinates and code adjustment to accomodate upgrade of groovy 4.x #4780

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

j-sandy
Copy link
Contributor

@j-sandy j-sandy commented Sep 16, 2024

  • Replacing the groovy coordinates from org.codehaus.groovy to org.apache.groovy supported by groovy 4.x and above versions.

  • While upgrading groovy 4.0.15:

Encounter below error during test executions of orca-clouddriver module and similar errors in orca-pipelinetemplate module:

No such property: disabled for class: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup
groovy.lang.MissingPropertyException: No such property: disabled for class: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup
	at app//com.netflix.spinnaker.orca.clouddriver.tasks.cluster.AbstractClusterWideClouddriverTask.isActive(AbstractClusterWideClouddriverTask.groovy:266)
	at com.netflix.spinnaker.orca.clouddriver.tasks.cluster.AbstractClusterWideClouddriverTask.filterActiveGroups_closure9(AbstractClusterWideClouddriverTask.groovy:187)
	at app//com.netflix.spinnaker.orca.clouddriver.tasks.cluster.AbstractClusterWideClouddriverTask.filterActiveGroups(AbstractClusterWideClouddriverTask.groovy:187)
	at app//com.netflix.spinnaker.orca.clouddriver.tasks.cluster.ScaleDownClusterTask.filterServerGroups(ScaleDownClusterTask.groovy:75)
	at com.netflix.spinnaker.orca.clouddriver.tasks.cluster.ScaleDownClusterTaskSpec.extracts config from context(ScaleDownClusterTaskSpec.groovy:49)

To fix this issue, replaced the fields with its getter method.

Encounter below error during compilation of orca-clouddriver module:

startup failed:
/orca/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/kato/pipeline/support/SourceResolver.groovy: 118: [Static type checking] - Cannot find matching method ?#compareTo(?). Please check if the declared type is correct and if the method exists.
 @ line 118, column 92.
   ze(a1)<=> instanceSize(a2) ?: created(a2
                                 ^

1 error

> Task :orca-clouddriver:compileGroovy FAILED

The root cause seems to be the type mismatch returned by created closure. To fix this issue typecasted the return value of 0 from Integer to Long.

Encounter below error during test executions of orca-clouddriver module and similar errors in orca-pipelinetemplate module:

No signature of method: com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), every(), grep()
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), every(), grep()
	at com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getJarList_closure2(JarDiffsTask.groovy:150)
	at app//com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getJarList(JarDiffsTask.groovy:143)
	at app//org.spockframework.mock.runtime.ByteBuddyMethodInvoker.respond(ByteBuddyMethodInvoker.java:20)
	at app//org.spockframework.mock.runtime.MockInvocation.callRealMethod(MockInvocation.java:61)
	at app//org.spockframework.mock.CallRealMethodResponse.respond(CallRealMethodResponse.java:30)
	at app//org.spockframework.mock.runtime.MockController.handle(MockController.java:50)
	at app//org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:86)
	at app//org.spockframework.mock.runtime.ByteBuddyInterceptorAdapter.interceptNonAbstract(ByteBuddyInterceptorAdapter.java:35)
	at com.netflix.spinnaker.orca.kato.tasks.JarDiffsTaskSpec.getJarList single server(JarDiffsTaskSpec.groovy:87)
No signature of method: com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), $getLookup(), every()
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), $getLookup(), every()
	at com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.execute_closure2(TriggerQuipTask.groovy:87)
	at app//groovy.lang.Closure.call(Closure.java:433)
	at app//com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.execute(TriggerQuipTask.groovy:71)
	at app//org.spockframework.mock.runtime.ByteBuddyMethodInvoker.respond(ByteBuddyMethodInvoker.java:20)
	at app//org.spockframework.mock.runtime.MockInvocation.callRealMethod(MockInvocation.java:61)
	at app//org.spockframework.mock.CallRealMethodResponse.respond(CallRealMethodResponse.java:30)
	at app//org.spockframework.mock.runtime.MockController.handle(MockController.java:50)
	at app//org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:86)
	at app//org.spockframework.mock.runtime.ByteBuddyInterceptorAdapter.interceptNonAbstract(ByteBuddyInterceptorAdapter.java:35)
	at com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTaskSpec.servers return errors, expect RUNNING(TriggerQuipTaskSpec.groovy:175)

To fix this issue, explicitly defined a method to return log object inside find{} and each{} closure. It may be related to this issue

micronaut-projects/micronaut-core#4933 (comment)

Encounter below error during test executions of orca-clouddriver module:

Condition not satisfied:

response.context.terminationInstanceIds == expectedTerminations
|        |       |                      |  |
|        |       [i-2, i-3, i-4]        |  [i-4, i-2, i-3]
|        |                              false
|        [terminationInstanceIds:[i-2, i-3, i-4], knownInstanceIds:[i-1, i-2, i-3, i-4], skipRemainingWait:true, waitTime:0]
TaskResult(status=SUCCEEDED, context={terminationInstanceIds=[i-2, i-3, i-4], knownInstanceIds=[i-1, i-2, i-3, i-4], skipRemainingWait=true, waitTime=0}, outputs={})

Condition not satisfied:

response.context.terminationInstanceIds == expectedTerminations
|        |       |                      |  |
|        |       [i-2, i-3, i-4]        |  [i-4, i-2, i-3]
|        |                              false
|        [terminationInstanceIds:[i-2, i-3, i-4], knownInstanceIds:[i-1, i-2, i-3, i-4], skipRemainingWait:true, waitTime:0]
TaskResult(status=SUCCEEDED, context={terminationInstanceIds=[i-2, i-3, i-4], knownInstanceIds=[i-1, i-2, i-3, i-4], skipRemainingWait=true, waitTime=0}, outputs={})

	at com.netflix.spinnaker.orca.kato.tasks.rollingpush.DetermineTerminationCandidatesTaskSpec.should order and filter instances correctly(DetermineTerminationCandidatesTaskSpec.groovy:58)

The root cause of this issue is breaking change, in the usage of intersect() method, introduced in groovy 4 here. To fix this issue, refactoring the code.

…to accomodate upgrade of groovy 4.x

- Replacing the groovy coordinates from `org.codehaus.groovy` to `org.apache.groovy` supported by groovy 4.x and above versions.

- While upgrading groovy 4.0.15:

Encounter below error during test executions of orca-clouddriver module and similar errors in orca-pipelinetemplate module:
```
No such property: disabled for class: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup
groovy.lang.MissingPropertyException: No such property: disabled for class: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup
	at app//com.netflix.spinnaker.orca.clouddriver.tasks.cluster.AbstractClusterWideClouddriverTask.isActive(AbstractClusterWideClouddriverTask.groovy:266)
	at com.netflix.spinnaker.orca.clouddriver.tasks.cluster.AbstractClusterWideClouddriverTask.filterActiveGroups_closure9(AbstractClusterWideClouddriverTask.groovy:187)
	at app//com.netflix.spinnaker.orca.clouddriver.tasks.cluster.AbstractClusterWideClouddriverTask.filterActiveGroups(AbstractClusterWideClouddriverTask.groovy:187)
	at app//com.netflix.spinnaker.orca.clouddriver.tasks.cluster.ScaleDownClusterTask.filterServerGroups(ScaleDownClusterTask.groovy:75)
	at com.netflix.spinnaker.orca.clouddriver.tasks.cluster.ScaleDownClusterTaskSpec.extracts config from context(ScaleDownClusterTaskSpec.groovy:49)
```
To fix this issue, replaced the fields with its getter method.

Encounter below error during compilation of orca-clouddriver module:
```
startup failed:
/orca/orca-clouddriver/src/main/groovy/com/netflix/spinnaker/orca/kato/pipeline/support/SourceResolver.groovy: 118: [Static type checking] - Cannot find matching method ?#compareTo(?). Please check if the declared type is correct and if the method exists.
 @ line 118, column 92.
   ze(a1)<=> instanceSize(a2) ?: created(a2
                                 ^

1 error

> Task :orca-clouddriver:compileGroovy FAILED
```
The root cause seems to be the type mismatch returned by `created` closure. To fix this issue typecasted the return value of `0` from Integer to Long.

Encounter below error during test executions of orca-clouddriver module and similar errors in orca-pipelinetemplate module:
```
No signature of method: com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), every(), grep()
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), every(), grep()
	at com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getJarList_closure2(JarDiffsTask.groovy:150)
	at app//com.netflix.spinnaker.orca.kato.tasks.JarDiffsTask.getJarList(JarDiffsTask.groovy:143)
	at app//org.spockframework.mock.runtime.ByteBuddyMethodInvoker.respond(ByteBuddyMethodInvoker.java:20)
	at app//org.spockframework.mock.runtime.MockInvocation.callRealMethod(MockInvocation.java:61)
	at app//org.spockframework.mock.CallRealMethodResponse.respond(CallRealMethodResponse.java:30)
	at app//org.spockframework.mock.runtime.MockController.handle(MockController.java:50)
	at app//org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:86)
	at app//org.spockframework.mock.runtime.ByteBuddyInterceptorAdapter.interceptNonAbstract(ByteBuddyInterceptorAdapter.java:35)
	at com.netflix.spinnaker.orca.kato.tasks.JarDiffsTaskSpec.getJarList single server(JarDiffsTaskSpec.groovy:87)
```

```
No signature of method: com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), $getLookup(), every()
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.getLog() is applicable for argument types: () values: []
Possible solutions: getAt(java.lang.String), getClass(), notify(), $getLookup(), $getLookup(), every()
	at com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.execute_closure2(TriggerQuipTask.groovy:87)
	at app//groovy.lang.Closure.call(Closure.java:433)
	at app//com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTask.execute(TriggerQuipTask.groovy:71)
	at app//org.spockframework.mock.runtime.ByteBuddyMethodInvoker.respond(ByteBuddyMethodInvoker.java:20)
	at app//org.spockframework.mock.runtime.MockInvocation.callRealMethod(MockInvocation.java:61)
	at app//org.spockframework.mock.CallRealMethodResponse.respond(CallRealMethodResponse.java:30)
	at app//org.spockframework.mock.runtime.MockController.handle(MockController.java:50)
	at app//org.spockframework.mock.runtime.JavaMockInterceptor.intercept(JavaMockInterceptor.java:86)
	at app//org.spockframework.mock.runtime.ByteBuddyInterceptorAdapter.interceptNonAbstract(ByteBuddyInterceptorAdapter.java:35)
	at com.netflix.spinnaker.orca.kato.tasks.quip.TriggerQuipTaskSpec.servers return errors, expect RUNNING(TriggerQuipTaskSpec.groovy:175)
```
To fix this issue, explicitly defined a method to return `log` object inside `find{}` and `each{}` closure. It may be related to this [issue](https://issues.apache.org/jira/browse/GROOVY-8820)

micronaut-projects/micronaut-core#4933 (comment)

Encounter below error during test executions of orca-clouddriver module:
```
Condition not satisfied:

response.context.terminationInstanceIds == expectedTerminations
|        |       |                      |  |
|        |       [i-2, i-3, i-4]        |  [i-4, i-2, i-3]
|        |                              false
|        [terminationInstanceIds:[i-2, i-3, i-4], knownInstanceIds:[i-1, i-2, i-3, i-4], skipRemainingWait:true, waitTime:0]
TaskResult(status=SUCCEEDED, context={terminationInstanceIds=[i-2, i-3, i-4], knownInstanceIds=[i-1, i-2, i-3, i-4], skipRemainingWait=true, waitTime=0}, outputs={})

Condition not satisfied:

response.context.terminationInstanceIds == expectedTerminations
|        |       |                      |  |
|        |       [i-2, i-3, i-4]        |  [i-4, i-2, i-3]
|        |                              false
|        [terminationInstanceIds:[i-2, i-3, i-4], knownInstanceIds:[i-1, i-2, i-3, i-4], skipRemainingWait:true, waitTime:0]
TaskResult(status=SUCCEEDED, context={terminationInstanceIds=[i-2, i-3, i-4], knownInstanceIds=[i-1, i-2, i-3, i-4], skipRemainingWait=true, waitTime=0}, outputs={})

	at com.netflix.spinnaker.orca.kato.tasks.rollingpush.DetermineTerminationCandidatesTaskSpec.should order and filter instances correctly(DetermineTerminationCandidatesTaskSpec.groovy:58)

```
The root cause of this issue is breaking change, in the usage of `intersect()` method, introduced in groovy 4 [here](https://groovy-lang.org/releasenotes/groovy-4.0.html#Groovy4.0-breaking). To fix this issue, refactoring the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant