Skip to content

Commit

Permalink
chore(dependencies): Autobump korkVersion (#1188)
Browse files Browse the repository at this point in the history
* chore(dependencies): Autobump korkVersion

* fix(web): fix exception handling in JenkinsBuildMonitor.processBuildsOfProject

The jenkinsClient inside JenkinsService comes from JenkinsConfig, wihch, as of
#1130, uses SpinnakerRetrofitErrorHandler.
Therefore, the getBuilds calls inside the try/catch block inside processBuildsOfProject
throws a SpinnakerServerException.

#1130 updated the 'should continue processing other
builds from a master even if one or more build fetches fail' test to throw a
SpinnakerServerException with a RetrofitError as its cause instead of a RuntimeException
with a RetrofitError as its cause.  With spinnaker/kork#1110, the
SpinnakerServerException no longer has a RetrofitError as its cause.  It has the "mock
root cause" exception as its cause.  But, because
spinnaker/kork#1110 adds a url attribute to
SpinnakerServerException, the cause is no longer necessary for including a url in the
"Error communicating with jenkins" log message, and this commit updates the logic
accordingly.

* refactor(web/test): clean up exception mocking in JenkinsBuildMonitorSpec

remove unused runtimeException and rename retrofitEx since it's no longer a retrofitEx

---------

Co-authored-by: root <root@2f91e8016c3c>
Co-authored-by: David Byron <dbyron@salesforce.com>
  • Loading branch information
3 people committed Oct 30, 2023
1 parent 8ff1cc3 commit 667678e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fiatVersion=1.42.0
korkVersion=7.195.0
korkVersion=7.196.0
org.gradle.parallel=true
spinnakerGradleVersion=8.31.0
targetJava11=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ import com.netflix.spinnaker.igor.polling.PollingDelta
import com.netflix.spinnaker.igor.service.BuildServices
import com.netflix.spinnaker.kork.discovery.DiscoveryStatusListener
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.netflix.spinnaker.security.AuthenticatedRequest
import groovy.time.TimeCategory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.scheduling.TaskScheduler
import org.springframework.stereotype.Service
import retrofit.RetrofitError
import java.util.stream.Collectors

import static net.logstash.logback.argument.StructuredArguments.kv
Expand Down Expand Up @@ -157,9 +157,8 @@ class JenkinsBuildMonitor extends CommonPollingMonitor<JobDelta, JobPollingDelta

} catch (e) {
log.error("Error processing builds for [{}:{}]", kv("master", master), kv("job", job.name), e)
if (e.cause instanceof RetrofitError) {
def re = (RetrofitError) e.cause
log.error("Error communicating with jenkins for [{}:{}]: {}", kv("master", master), kv("job", job.name), kv("url", re.url), re)
if (e instanceof SpinnakerServerException) {
log.error("Error communicating with jenkins for [{}:{}]: {}", kv("master", master), kv("job", job.name), kv("url", e.url), e)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,8 @@ class JenkinsBuildMonitorSpec extends Specification {
new Build(number: 1, timestamp: nowMinus30min, building: false, result: 'SUCCESS', duration: durationOf1min)
]

def retrofitEx = new SpinnakerServerException(RetrofitError.unexpectedError("http://retro.fit/mock/error", new Exception('mock root cause')));
def runtimeException = new RuntimeException ("Mocked failure while fetching 'job2'", retrofitEx)
jenkinsService.getBuilds('job2') >> { throw runtimeException.getCause() }
def spinnakerServerException = new SpinnakerServerException(RetrofitError.unexpectedError("http://retro.fit/mock/error", new Exception('mock root cause')));
jenkinsService.getBuilds('job2') >> { throw spinnakerServerException }

jenkinsService.getBuilds('job3') >> [
new Build(number: 3, timestamp: nowMinus30min, building: false, result: 'SUCCESS', duration: durationOf1min)
Expand Down

0 comments on commit 667678e

Please sign in to comment.