You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- markdownlint-disable MD041 -->
#### What this PR does / why we need it
This PR implements the transformers from
open-component-model#1832
It creates a 3-step-transformation for the helm chart
transformation-chain:
```mermaid
flowchart TD
A[Transfer Helm Chart] -->B(Get Helm Chart)
B --> C{Download from Repo}
C -->|Has Prov| D[Download from Repo]
C --> E{Pack Helm LocalBlob}
D --> E
E -->|GetHelmOutput| F{Convert to OCI}
F -->|ConverToHelm| G{Pack OCI from Helm}
F -->|ConverToHelm with prov| G{Pack OCI from Helm}
G -->|upload-as localBlob/default | I{Upload as localBlob}
G -->|upload-as ociArtifact | H{Upload as OCI Image}
```
1. get helm chart with `GetHelmChartV1alpha1`
2. convert helm to OCI with `ConvertHelmToOCIV1alpha1`
3. upload
a. localBlobl: the oci artifact with `OCIAddLocalResourceV1alpha1`
b. ociArtifact: the oci artifact with `AddOCIArtifactType`
The [spec
PR](open-component-model#1832)
will be kept in sync with changed from here in the `bindings/go/helm`
package.
#### Which issue(s) this PR fixes
Contributes:
open-component-model/ocm-project#883
#### Testing
##### How to test the changes
```bash
#!/bin/zsh
alias OCM='go run ../../main.go'
REGISTRY="ghcr.io/matthiasbruns/ocm-tutorials"
REGISTRY2="ghcr.io/matthiasbruns/ocm-tutorials-2"
pause() {
echo "\n>>> Next: $1"
echo "--- Press Enter to continue ---"
read
}
# OCM --help
# create constructor.yaml
# https://stefanprodan.github.io/podinfo/podinfo-6.9.1.tgz
cat <<EOF > constructor.yaml
components:
- name: ocm.software/podinfo
version: 6.9.1
provider:
name: ocm.software
resources:
- name: podinfo
version: 6.9.1
type: helmChart
access:
type: helm/v1
helmRepository: https://stefanprodan.github.io/podinfo
helmChart: podinfo-6.9.1.tgz
EOF
CTF_DIR=$(mktemp -d)
echo "Using temporary directory: $CTF_DIR"
pause "Add component version to CTF from constructor.yaml"
# add cv command
OCM add cv --repository ctf::$CTF_DIR --constructor constructor.yaml --skip-reference-digest-processing
HELM_REF="ctf::$CTF_DIR//ocm.software/podinfo:6.9.1"
pause "Create component version ($REGISTRY)"
# transfer
OCM transfer component-version $HELM_REF $REGISTRY --copy-resources
pause "Transfer with --upload-as localBlob (OCI registry)"
# transfer --upload-as localBlob
OCM transfer component-version $HELM_REF $REGISTRY --copy-resources --upload-as localBlob
pause "Transfer with --upload-as ociArtifact (OCI registry)"
# transfer --upload-as ociArtifact
OCM transfer component-version $HELM_REF $REGISTRY --copy-resources --upload-as ociArtifact
pause "Download component descriptor with oras"
# download with oras
oras pull $REGISTRY/component-descriptors/ocm.software/podinfo:6.9.1 --output .
pause "Download resource using OCM CLI"
# rm downloaded if exists
rm -rf downloaded
# downloadCMD resource
OCM download resource https://$REGISTRY//ocm.software/podinfo:6.9.1 --identity name=podinfo,version=6.9.1 --output ./downloaded
```
You can also unpack the blob and it should contain the `podinfo` chart
contents
# transfer oci helm to another oci
`ocm transfer component-version
http://$REGISTRY//ocm.software/podinfo:6.9.1 $REGISTRY2 --copy-resources
--upload-as ociArtifact`
##### Verification
- [x] I have tested the changes locally by running `ocm`
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Added support for transferring Helm charts as part of component
version transfers
* Helm charts can now be converted to OCI artifacts during transfer
* Support for both local Helm chart paths and remote Helm repositories
as transfer sources
* **Documentation**
* Updated transfer command documentation with Helm chart transfer
capabilities and examples
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
- See the [community docs](docs/community/) for SIGs and meetings or check out how to engage with us on our [website](https://ocm.software/community/engagement/)!
100
+
- See the [community docs](docs/community/) for SIGs and meetings or check out how to engage with us on
enum.Var(cmd.Flags(), FlagExternalComponentVersionCopyPolicy, ExternalComponentVersionCopyPolicies(), "policy to apply when a component reference to a component version outside of the constructor or target repository is encountered")
208
208
cmd.Flags().Bool(FlagSkipReferenceDigestProcessing, false, "skip digest processing for resources and sources. Any resource referenced via access type will not have their digest updated.")
209
209
enum.VarP(cmd.Flags(), FlagOutput, "o", []string{render.OutputFormatTable.String(), render.OutputFormatYAML.String(), render.OutputFormatJSON.String(), render.OutputFormatNDJSON.String(), render.OutputFormatTree.String()}, "output format of the component descriptors")
210
-
enum.VarP(cmd.Flags(), FlagDisplayMode, "", []string{render.StaticRenderMode, render.LiveRenderMode}, `display mode can be used in combination with --recursive
211
-
static: print the output once the complete component graph is discovered
210
+
enum.VarP(cmd.Flags(), FlagDisplayMode, "", []string{render.StaticRenderMode, render.LiveRenderMode}, `static: print the output once the complete component graph is discovered
212
211
live (experimental): continuously updates the output to represent the current construction state of the component graph`)
0 commit comments