Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: jfrog plugin + helm upload handler #1167

Merged

Conversation

jakobmoellerdev
Copy link
Contributor

@jakobmoellerdev jakobmoellerdev commented Nov 29, 2024

What this PR does / why we need it

Implements a JFrog Plugin that contains an uploader that is able to upload to JFrog Helm Chart Repositories (different from OCI).

Example Reference Upload configuration:

- type: credentials.config.ocm.software
  consumers:
  - identity:
      type: JFrogHelm
      hostname: int.repositories.cloud.sap
    credentials:
    - type: Credentials/v1
      properties:
        username: "your-user-here"
        password: "your-token-here"
- type: uploader.ocm.config.ocm.software
  registrations:
  - name: plugin/jfrog/JFrogHelm
    artifactType: helmChart
    priority: 200
    config:
      type: JFrogHelm/v1alpha1
      url: "your-artifactory-url-here"
      repository: "your-repository-here"
      # reindexAfterUpload: true # in case you want to force a reindex, requires admin repository credentials, off by default

The plugin will be installable with

ocm install plugin ghcr.io/open-component-model/ocm//ocm.software/plugins/jfrogplugin

as it is added to our parallel build list.

Since during development (while this PR does not get merged and we dont have an RC) you cannot use this command, you can choose to either push your own version of the plugin (there are commands in the new makefile), or you can run (also in the new makefile):

make -C components/jfrogplugin install

which will do a build and install locally so you can use it without fetching it remotely

Once added, you can run something like

ocm plugin get jfrog -oyaml
---
element:
  description: "ALPHA GRADE plugin providing custom functions related to interacting
    with JFrog Repositories (e.g. Artifactory).\n\nThis plugin is solely for interacting
    with JFrog Servers and cannot be used for generic repository types.\nThus, you
    should only consider this plugin if\n- You need to use a JFrog specific API\n-
    You cannot use any of the generic (non-jfrog) implementations.\n\nExamples:\n\nYou
    can configure the JFrog plugin as an Uploader in an ocm config file with:\n\n-
    type: uploader.ocm..config.ocm.software\n  registrations:\n  - name: plugin/jfrog/JFrogHelm\n
    \   artifactType: helmChart\n    priority: 200 # must be > 100 to be used over
    the default handler\n    config:\n      type: JFrogHelm/v1alpha1\n      # this
    is only a sample JFrog Server URL, do NOT append /artifactory\n      url: int.repositories.ocm.software
    \n      repository: ocm-helm-test\n"
  forwardLogging: true
  pluginName: jfrog
  pluginVersion: 0.20.0-dev+962ef1469035fbd7b855dff1ccb6ddfc06269745
  shortDescription: jfrog plugin
  uploaders:
  - constraints:
    - artifactType: helmChart
      contextType: ""
      mediaType: ""
      repositoryType: ""
    description: upload artifacts to JFrog HELM repositories by using the JFrog REST
      API.
    name: JFrogHelm
  version: v1

to introspect it.

The plugin is now able to be used by OCM.

The plugin registers itself for the mediaTypes of a Helm Chart TGZ as well as OCI artifacts to convert them. Notably, the OCI artifact conversion is lossy because the provenance data is omitted, so back and forth conversion while maintaining digests might not always be possible in a fully trusted environment

Which issue(s) this PR fixes

fix #1116

@github-actions github-actions bot added kind/feature new feature, enhancement, improvement, extension size/l Large labels Nov 29, 2024
@github-actions github-actions bot added the component/github-actions Changes on GitHub Actions or within `.github/` directory label Dec 3, 2024
@jakobmoellerdev jakobmoellerdev marked this pull request as ready for review December 11, 2024 16:52
@jakobmoellerdev jakobmoellerdev requested a review from a team as a code owner December 11, 2024 16:52
@Skarlso Skarlso self-assigned this Dec 16, 2024
Copy link
Contributor

@Skarlso Skarlso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review before starting to play around with this.

api/ocm/plugin/cache/updater.go Show resolved Hide resolved
api/ocm/plugin/cache/updater.go Show resolved Hide resolved
api/ocm/plugin/plugin.go Show resolved Hide resolved
api/ocm/plugin/plugin.go Outdated Show resolved Hide resolved
api/ocm/plugin/ppi/cmds/upload/put/cmd.go Outdated Show resolved Hide resolved
cmds/jfrogplugin/uploaders/helm/helm.go Outdated Show resolved Hide resolved
cmds/jfrogplugin/uploaders/helm/helm.go Show resolved Hide resolved
cmds/jfrogplugin/uploaders/helm/helm.go Outdated Show resolved Hide resolved
cmds/jfrogplugin/uploaders/helm/helm.go Outdated Show resolved Hide resolved
cmds/jfrogplugin/uploaders/helm/upload.go Outdated Show resolved Hide resolved
Co-authored-by: Gergely Brautigam <[email protected]>
@hilmarf hilmarf added this to the 2024-Q4 milestone Dec 19, 2024
@github-actions github-actions bot added the area/documentation Documentation related label Jan 6, 2025
Copy link
Contributor

@Skarlso Skarlso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! :) Thanks for bearing with me. :D

@jakobmoellerdev jakobmoellerdev merged commit ada5381 into open-component-model:main Jan 8, 2025
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Documentation related component/github-actions Changes on GitHub Actions or within `.github/` directory kind/feature new feature, enhancement, improvement, extension size/l Large
Projects
Status: 🍺 Done
Development

Successfully merging this pull request may close these issues.

Create uploader handler for artifact type "helmChart" to Helm repositores
3 participants