Skip to content

Instantly share code, notes, and snippets.

@jwntrs
Last active February 11, 2022 20:25
Show Gist options
  • Save jwntrs/5cb67f37ed9963cb8381cdcc90bc4e00 to your computer and use it in GitHub Desktop.
Save jwntrs/5cb67f37ed9963cb8381cdcc90bc4e00 to your computer and use it in GitHub Desktop.
Inline typed supply chains
apiVersion: carto.run/v1alpha1
kind: ClusterSupplyChain
metadata:
name: supply-chain
spec:
selector:
matchLabels:
workload-type: web
snippets:
- name: building-image
kind: ClusterImageSupplyChain
imagePath: image-builder.status.latestImage
resources:
- name: provide-source
templateRef:
kind: ClusterSourceTemplate
options:
- name: providing-and-testing-source
selector:
matchFields:
- {key: "metadata.labels.has-tests", operation: In, value: ["true"]}
- name: source-from-git-repo
selector:
matchFields:
- { key: "spec.source.url", operation: exists }
- { key: "metadata.labels.has-tests", operation: NotIn, value: ["true"] }
- name: source-from-image-registry
selector:
matchFields:
- { key: "spec.source.image", operation: exists }
- { key: "metadata.labels.has-tests", operation: NotIn, value: ["true"] }
- name: image-builder
templateRef:
kind: ClusterImageTemplate
name: build-image
sources:
- resource: provide-source
name: source
- name: providing-and-testing-source
kind: ClusterSourceSupplyChain
urlPath: test-source.status.artifact.url
revisionPath: test-source.status.artifact.revision
resources:
- name: provide-source
templateRef:
kind: ClusterSourceTemplate
options:
- name: source-from-git-repo
selector:
matchFields:
- { key: "spec.source.url", operation: exists }
- name: source-from-image-registry
selector:
matchFields:
- { key: "spec.source.image", operation: exists }
- name: test-source
templateRef:
kind: ClusterSourceTemplate
name: source-tester
resources:
- name: provide-image
templateRef:
kind: ClusterImageTemplate
options:
- name: building-image
selector:
matchFields:
- key: "spec.source.url"
operation: exists
- name: building-image
selector:
matchFields:
- key: "spec.source.image"
operation: exists
- name: image-provider
selector:
matchFields:
- { key: "spec.image", operation: exists }
- name: configure
templateRef:
kind: ClusterConfigTemplate
name: configure
images:
- resource: provide-image
name: image
- name: gitops
templateRef:
kind: ClusterTemplate
options:
- name: git-pusher
selector:
matchFields:
- key: "metadata.labels.target"
operation: In
value: ["gitops"]
- name: registry-pusher
selector:
matchFields:
- key: "metadata.labels.target"
operation: In
value: ["repository"]
configs:
- resource: configure
name: config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment