Skip to content

Commit

Permalink
feat(artifacts): Add ArtifactStore to orca (#4481)
Browse files Browse the repository at this point in the history
This commit adds artifact storage to orca. The new artifact type
remote/base64 is completely compatible with SpEL and users can use the
same SpEL expressions. Meaning that this change should be completely
transparent to users

Signed-off-by: benjamin-j-powell <[email protected]>
Co-authored-by: Benevolent Benjamin Powell <[email protected]>
Co-authored-by: Nicolas Favre-Felix <[email protected]>
  • Loading branch information
3 people authored Jul 6, 2023
1 parent 00301b4 commit b23c78b
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.jakewharton.retrofit.Ok3Client;
import com.netflix.spinnaker.config.DefaultServiceEndpoint;
import com.netflix.spinnaker.config.okhttp3.OkHttpClientProvider;
import com.netflix.spinnaker.kork.artifacts.artifactstore.ArtifactStoreConfiguration;
import com.netflix.spinnaker.kork.core.RetrySupport;
import com.netflix.spinnaker.kork.web.selector.DefaultServiceSelector;
import com.netflix.spinnaker.kork.web.selector.SelectableService;
Expand All @@ -47,7 +48,7 @@
import retrofit.converter.JacksonConverter;

@Configuration
@Import(RetrofitConfiguration.class)
@Import({RetrofitConfiguration.class, ArtifactStoreConfiguration.class})
@ComponentScan({
"com.netflix.spinnaker.orca.clouddriver",
"com.netflix.spinnaker.orca.kato.pipeline",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.collect.ImmutableMap;
import com.netflix.spinnaker.kork.artifacts.ArtifactTypes;
import com.netflix.spinnaker.kork.artifacts.model.Artifact;
import java.util.Base64;
import java.util.Collections;
Expand Down Expand Up @@ -47,7 +48,7 @@ public Artifact getArtifact() {
if (direct != null) {
return Artifact.builder()
.name("manifest")
.type("embedded/base64")
.type(ArtifactTypes.EMBEDDED_BASE64.getMimeType())
.artifactAccount("embedded-artifact")
.reference(Base64.getEncoder().encodeToString(direct.toManifestYml().getBytes()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.netflix.spinnaker.kork.artifacts.ArtifactTypes;
import com.netflix.spinnaker.kork.artifacts.model.Artifact;
import java.io.IOException;
import java.util.Base64;
Expand Down Expand Up @@ -53,7 +54,7 @@ public Artifact getArtifact() {
if (direct != null) {
return Artifact.builder()
.name("manifest")
.type("embedded/base64")
.type(ArtifactTypes.EMBEDDED_BASE64.getMimeType())
.artifactAccount("embedded-artifact")
.reference(Base64.getEncoder().encodeToString(direct.toManifestYml().getBytes()))
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.netflix.spinnaker.kork.artifacts.ArtifactTypes;
import com.netflix.spinnaker.kork.artifacts.model.Artifact;
import com.netflix.spinnaker.kork.core.RetrySupport;
import com.netflix.spinnaker.orca.clouddriver.OortService;
Expand Down Expand Up @@ -108,7 +109,7 @@ void artifactManifestIgnoreNullYAMLDocuments() {
Artifact manifestArtifact =
Artifact.builder()
.artifactAccount("my-artifact-account")
.type("embedded/base64")
.type(ArtifactTypes.EMBEDDED_BASE64.getMimeType())
.customKind(false)
.name("somename")
.reference(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.netflix.spectator.api.Registry;
import com.netflix.spinnaker.config.PluginsAutoConfiguration;
import com.netflix.spinnaker.kork.api.expressions.ExpressionFunctionProvider;
import com.netflix.spinnaker.kork.artifacts.artifactstore.ArtifactStoreConfiguration;
import com.netflix.spinnaker.kork.core.RetrySupport;
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService;
import com.netflix.spinnaker.kork.expressions.config.ExpressionProperties;
Expand Down Expand Up @@ -84,11 +85,13 @@
"com.netflix.spinnaker.orca.preprocessors",
"com.netflix.spinnaker.orca.telemetry",
"com.netflix.spinnaker.orca.notifications.scheduling",
"com.netflix.spinnaker.orca.lock"
"com.netflix.spinnaker.orca.lock",
"com.netflix.spinnaker.kork.artifacts.model",
})
@Import({
PreprocessorConfiguration.class,
PluginsAutoConfiguration.class,
ArtifactStoreConfiguration.class,
})
@EnableConfigurationProperties({
TaskOverrideConfigurationProperties.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.netflix.spinnaker.orca.front50
import com.fasterxml.jackson.databind.JavaType
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spectator.api.NoopRegistry
import com.netflix.spinnaker.kork.artifacts.ArtifactTypes
import com.netflix.spinnaker.kork.artifacts.model.Artifact
import com.netflix.spinnaker.kork.artifacts.model.ExpectedArtifact
import com.netflix.spinnaker.orca.api.pipeline.models.PipelineExecution
Expand Down Expand Up @@ -848,7 +849,7 @@ class DependentPipelineStarterSpec extends Specification {
matchArtifact: [
kind: "base64",
name: "baked-manifest",
type: "embedded/base64"
type: ArtifactTypes.EMBEDDED_BASE64.getMimeType()
],
useDefaultArtifact: false
]],
Expand Down

0 comments on commit b23c78b

Please sign in to comment.