This repository was archived by the owner on Dec 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 786
feat(pipelineRef): Replace PipelineTrigger with PipelineRef for Spinnaker UI #4842
Closed
edgarulg
wants to merge
10
commits into
spinnaker:master
from
edgarulg:lazy-loading-using-pipeline-ref
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2af5e8e
feat(pipelineRef): add includeNestedExecutions flag in executionRepos…
edgarulg 4528f5a
feat(pipelineRef): implement includeNestedExecution flag in SqlExecut…
edgarulg 890e2a4
feat(pipelineRef): retrieve executions with nested executions for the…
edgarulg 2fd955c
feat(pipelineRef): fix existing test in orca
edgarulg 4485cd4
test(pipelineRef): add tests around pipelineRef with includeNestedExe…
edgarulg 9ad9641
test(pipelineRef): define integration tests for pipelineRef and inclu…
edgarulg 07df36d
Merge branch 'master' into lazy-loading-using-pipeline-ref
jasonmcintosh 31bc285
test(pipelineRef): add tests in TaskController for pipelineRef
edgarulg ad4b427
Merge branch 'master' into lazy-loading-using-pipeline-ref
jasonmcintosh f48fa2c
Merge branch 'master' into lazy-loading-using-pipeline-ref
jasonmcintosh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
211 changes: 211 additions & 0 deletions
211
...ql/src/test/kotlin/com/netflix/spinnaker/orca/q/sql/SqlQueuePipelineRefIntegrationTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| /* | ||
| * Copyright 2025 Harness, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package com.netflix.spinnaker.orca.q.sql | ||
|
|
||
| import com.fasterxml.jackson.databind.DeserializationFeature | ||
| import com.fasterxml.jackson.databind.ObjectMapper | ||
| import com.fasterxml.jackson.databind.module.SimpleModule | ||
| import com.fasterxml.jackson.module.kotlin.KotlinModule | ||
| import com.netflix.spectator.api.Registry | ||
| import com.netflix.spinnaker.config.ExecutionCompressionProperties | ||
| import com.netflix.spinnaker.config.ObjectMapperSubtypeProperties | ||
| import com.netflix.spinnaker.config.OrcaSqlProperties | ||
| import com.netflix.spinnaker.config.SpringObjectMapperConfigurer | ||
| import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService | ||
| import com.netflix.spinnaker.kork.jedis.RedisClientDelegate | ||
| import com.netflix.spinnaker.kork.jedis.RedisClientSelector | ||
| import com.netflix.spinnaker.kork.sql.config.RetryProperties | ||
| import com.netflix.spinnaker.kork.sql.config.SqlProperties | ||
| import com.netflix.spinnaker.kork.sql.config.SqlRetryProperties | ||
| import com.netflix.spinnaker.kork.sql.test.SqlTestUtil | ||
| import com.netflix.spinnaker.orca.TaskResolver | ||
| import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType | ||
| import com.netflix.spinnaker.orca.config.JedisConfiguration | ||
| import com.netflix.spinnaker.orca.config.RedisConfiguration | ||
| import com.netflix.spinnaker.orca.pipeline.model.support.CustomTriggerDeserializerSupplier | ||
| import com.netflix.spinnaker.orca.pipeline.model.support.TriggerDeserializer | ||
| import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository | ||
| import com.netflix.spinnaker.orca.q.PipelineRefQueueIntegrationTest | ||
| import com.netflix.spinnaker.orca.q.TestConfig | ||
| import com.netflix.spinnaker.orca.q.migration.ExecutionTypeDeserializer | ||
| import com.netflix.spinnaker.orca.q.migration.TaskTypeDeserializer | ||
| import com.netflix.spinnaker.orca.q.sql.pending.SqlPendingExecutionService | ||
| import com.netflix.spinnaker.orca.sql.PipelineRefTriggerDeserializerSupplier | ||
| import com.netflix.spinnaker.orca.sql.pipeline.persistence.SqlExecutionRepository | ||
| import com.netflix.spinnaker.orca.test.redis.EmbeddedRedisConfiguration | ||
| import com.netflix.spinnaker.q.Queue | ||
| import com.netflix.spinnaker.q.metrics.EventPublisher | ||
| import com.netflix.spinnaker.q.metrics.MonitorableQueue | ||
| import com.netflix.spinnaker.q.sql.SqlQueue | ||
| import de.huxhorn.sulky.ulid.ULID | ||
| import org.jooq.DSLContext | ||
| import org.junit.jupiter.api.extension.ExtendWith | ||
| import org.springframework.boot.test.context.SpringBootTest | ||
| import org.springframework.boot.test.mock.mockito.MockBean | ||
| import org.springframework.context.annotation.Bean | ||
| import org.springframework.context.annotation.Configuration | ||
| import org.springframework.test.context.junit.jupiter.SpringExtension | ||
| import java.time.Clock | ||
| import java.time.Duration | ||
| import java.util.Optional | ||
| import javax.sql.DataSource | ||
|
|
||
| @Configuration | ||
| class SqlPipelineRefTestConfig { | ||
| @Bean | ||
| fun jooq(): DSLContext { | ||
| val testDatabase = SqlTestUtil.initTcMysqlDatabase() | ||
| return testDatabase.context | ||
| } | ||
|
|
||
| @Bean | ||
| fun sqlQueueObjectMapper( | ||
| mapper: ObjectMapper, | ||
| objectMapperSubtypeProperties: ObjectMapperSubtypeProperties, | ||
| taskResolver: TaskResolver | ||
| ): ObjectMapper { | ||
| return mapper.apply { | ||
| registerModule(KotlinModule.Builder().build()) | ||
| registerModule( | ||
| SimpleModule() | ||
| .addDeserializer(ExecutionType::class.java, ExecutionTypeDeserializer()) | ||
| .addDeserializer(Class::class.java, TaskTypeDeserializer(taskResolver)) | ||
| ) | ||
| disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) | ||
|
|
||
| SpringObjectMapperConfigurer( | ||
| objectMapperSubtypeProperties.apply { | ||
| messagePackages = messagePackages + listOf("com.netflix.spinnaker.orca.q") | ||
| attributePackages = attributePackages + listOf("com.netflix.spinnaker.orca.q") | ||
| } | ||
| ).registerSubtypes(this) | ||
| } | ||
| } | ||
|
|
||
| @Bean | ||
| fun queue( | ||
| jooq: DSLContext, | ||
| clock: Clock, | ||
| mapper: ObjectMapper, | ||
| publisher: EventPublisher | ||
| ): MonitorableQueue = | ||
| SqlQueue( | ||
| "test", | ||
| 1, | ||
| jooq, | ||
| clock, | ||
| 1, | ||
| mapper, Optional.empty(), | ||
| Duration.ofSeconds(1), | ||
| emptyList(), | ||
| true, | ||
| publisher, | ||
| SqlRetryProperties(), | ||
| ULID() | ||
| ) | ||
|
|
||
| @Bean | ||
| fun sqlExecutionRepository( | ||
| dsl: DSLContext, | ||
| mapper: ObjectMapper, | ||
| registry: Registry, | ||
| properties: SqlProperties, | ||
| orcaSqlProperties: OrcaSqlProperties, | ||
| compressionProperties: ExecutionCompressionProperties, | ||
| dataSource: DataSource | ||
| ) = SqlExecutionRepository( | ||
| orcaSqlProperties.partitionName, | ||
| dsl, | ||
| mapper, | ||
| properties.retries.transactions, | ||
| orcaSqlProperties.batchReadSize, | ||
| orcaSqlProperties.stageReadSize, | ||
| interlink = null, | ||
| compressionProperties = compressionProperties, | ||
| pipelineRefEnabled = true, | ||
| dataSource = dataSource | ||
| ) | ||
|
|
||
| @Bean | ||
| fun pipelineRefTriggerDeserializer(): CustomTriggerDeserializerSupplier { | ||
| val customTrigger = PipelineRefTriggerDeserializerSupplier(pipelineRefEnabled = true) | ||
| TriggerDeserializer.customTriggerSuppliers.add(customTrigger) | ||
| return customTrigger | ||
| } | ||
|
|
||
| @Bean | ||
| fun pendingExecutionService( | ||
| jooq: DSLContext, | ||
| queue: Queue, | ||
| repository: ExecutionRepository, | ||
| mapper: ObjectMapper, | ||
| clock: Clock, | ||
| registry: Registry | ||
| ) = | ||
| SqlPendingExecutionService( | ||
| "test", | ||
| jooq, | ||
| queue, | ||
| repository, | ||
| mapper, | ||
| clock, | ||
| registry, | ||
| RetryProperties(), | ||
| 5 | ||
| ) | ||
|
|
||
| @Bean | ||
| fun orcaSqlProperties(): OrcaSqlProperties { | ||
| return OrcaSqlProperties() | ||
| } | ||
|
|
||
| // TODO: remove this once Redis is no longer needed for distributed locking | ||
| @Bean | ||
| fun redisClientSelector(redisClientDelegates: List<RedisClientDelegate>) = | ||
| RedisClientSelector(redisClientDelegates) | ||
| } | ||
|
|
||
| @ExtendWith(SpringExtension::class) | ||
| @SpringBootTest( | ||
| classes = [ | ||
| SqlTestConfig::class, | ||
| SqlProperties::class, | ||
| ExecutionCompressionProperties::class, | ||
| TestConfig::class, | ||
| DynamicConfigService.NoopDynamicConfig::class, | ||
| EmbeddedRedisConfiguration::class, | ||
| JedisConfiguration::class, | ||
| RedisConfiguration::class | ||
| ], | ||
| properties = [ | ||
| "queue.retry.delay.ms=10", | ||
| "logging.level.root=ERROR", | ||
| "logging.level.org.springframework.test=ERROR", | ||
| "logging.level.com.netflix.spinnaker=FATAL", | ||
| "execution-repository.sql.enabled=true", | ||
| "execution-repository.redis.enabled=false", | ||
| "keiko.queue.redis.enabled=false", | ||
| "keiko.queue.sql.enabled=true", | ||
| "keiko.queue.fillExecutorEachCycle=false", | ||
| "sql.enabled=true", | ||
| "spring.application.name=orcaTest" | ||
| ] | ||
| ) | ||
| class SqlQueuePipelineRefIntegrationTest: PipelineRefQueueIntegrationTest() { | ||
| @MockBean | ||
| var dataSource: DataSource? = null | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible
booleaninstead ofBoolean?