-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(RELEASE-1434): allow to override volume type (#666)
This is a provisional change that will be used during the transition to using Trusted Artificts in the release-service-catalog pipelines. Trusted Artifacts requireis to use an emptyDir in opposition to the PVCs used today. This change allow to override the volume type used by a given pipeline by defining a list of EmptyDirOverride items which contain the details of the pipeline to be overriden. Regex is supported in the url and revision values. Signed-off-by: David Moreno García <[email protected]>
- Loading branch information
1 parent
11f89cf
commit 5954f10
Showing
10 changed files
with
405 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,71 @@ | ||
/* | ||
Copyright 2022. | ||
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 v1alpha1 | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var _ = Describe("ReleaseServiceConfig type", func() { | ||
When("IsPipelineOverridden method is called", func() { | ||
var releaseServiceConfig *ReleaseServiceConfig | ||
|
||
BeforeEach(func() { | ||
releaseServiceConfig = &ReleaseServiceConfig{ | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "config", | ||
Namespace: "default", | ||
}, | ||
} | ||
}) | ||
|
||
It("should return false if the resource is not overridden", func() { | ||
Expect(releaseServiceConfig.IsPipelineOverridden("foo", "bar", "baz")).To(BeFalse()) | ||
}) | ||
|
||
It("should return true if the resource is overridden", func() { | ||
releaseServiceConfig.Spec.EmptyDirOverrides = []EmptyDirOverrides{ | ||
{"foo", "bar", "baz"}, | ||
} | ||
Expect(releaseServiceConfig.IsPipelineOverridden("foo", "bar", "baz")).To(BeTrue()) | ||
}) | ||
|
||
It("should return true if the resource is overridden using a regex expression in the url field", func() { | ||
releaseServiceConfig.Spec.EmptyDirOverrides = []EmptyDirOverrides{ | ||
{".*", "bar", "baz"}, | ||
} | ||
Expect(releaseServiceConfig.IsPipelineOverridden("foo", "bar", "baz")).To(BeTrue()) | ||
}) | ||
|
||
It("should return true if the resource is overridden using a regex expression in the revision field", func() { | ||
releaseServiceConfig.Spec.EmptyDirOverrides = []EmptyDirOverrides{ | ||
{"foo", ".*", "baz"}, | ||
} | ||
Expect(releaseServiceConfig.IsPipelineOverridden("foo", "bar", "baz")).To(BeTrue()) | ||
}) | ||
|
||
It("should return false if the resource is overridden using a regex expression in the pathInRepo field", func() { | ||
releaseServiceConfig.Spec.EmptyDirOverrides = []EmptyDirOverrides{ | ||
{"foo", "bar", ".*"}, | ||
} | ||
Expect(releaseServiceConfig.IsPipelineOverridden("foo", "bar", "baz")).To(BeFalse()) | ||
}) | ||
}) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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.