-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #586 from fluxcd/rewrite-dev
- Loading branch information
Showing
69 changed files
with
12,101 additions
and
4,087 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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
Copyright 2022 The Flux authors | ||
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 v1beta2 | ||
|
||
import ( | ||
"path" | ||
"strings" | ||
|
||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// Artifact represents the output of a Source synchronisation. | ||
type Artifact struct { | ||
// Path is the relative file path of this Artifact. | ||
// It can be used to locate the Artifact file in the root of the Artifact | ||
// storage on the local file system of the controller managing the Source. | ||
// +required | ||
Path string `json:"path"` | ||
|
||
// URL is the HTTP address of this artifact. | ||
// It is used by the consumers of the artifacts to fetch and use the | ||
// artifacts. It is expected to be resolvable from within the cluster. | ||
// +required | ||
URL string `json:"url"` | ||
|
||
// Revision is a human readable identifier traceable in the origin source | ||
// system. It can be a Git commit SHA, Git tag, a Helm index timestamp, a Helm | ||
// chart version, etc. | ||
// +optional | ||
Revision string `json:"revision"` | ||
|
||
// Checksum is the SHA256 checksum of the artifact. | ||
// +optional | ||
Checksum string `json:"checksum"` | ||
|
||
// LastUpdateTime is the timestamp corresponding to the last update of this | ||
// artifact. | ||
// +required | ||
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` | ||
} | ||
|
||
// HasRevision returns true if the given revision matches the current Revision | ||
// of the Artifact. | ||
func (in *Artifact) HasRevision(revision string) bool { | ||
if in == nil { | ||
return false | ||
} | ||
return in.Revision == revision | ||
} | ||
|
||
// ArtifactDir returns the artifact dir path in the form of | ||
// <source-kind>/<source-namespace>/<source-name>. | ||
func ArtifactDir(kind, namespace, name string) string { | ||
kind = strings.ToLower(kind) | ||
return path.Join(kind, namespace, name) | ||
} | ||
|
||
// ArtifactPath returns the artifact path in the form of | ||
// <source-kind>/<source-namespace>/<source-name>/<artifact-filename>. | ||
func ArtifactPath(kind, namespace, name, filename string) string { | ||
return path.Join(ArtifactDir(kind, namespace, name), filename) | ||
} |
Oops, something went wrong.