Skip to content

Add support for OCI registry to push/pull plugins #5779

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

Merged
merged 9 commits into from
May 8, 2025

Conversation

Warashi
Copy link
Member

@Warashi Warashi commented Apr 25, 2025

What this PR does:

  • add pipectl plugin push command to push plugin binary to OCI Registry
    • The auth feature has not been implemented yet
  • add oci as an allowed scheme to download a plugin

We can use the pipectl plugin push as the command below

$ docker run -d --rm -p 5001:5000 --name registry registry
$ pipectl plugin push --tag=latest --registry=localhost:5001 --repository=piped-kubernetes --files=darwin/arm64=./.artifacts/plugins/kubernetes --insecure
$ pipectl plugin push --tag=latest --registry=localhost:5001 --repository=piped-wait --files=darwin/arm64=./.artifacts/plugins/wait --insecure

And we can pull the plugins from OCI Registry with the config below.

apiVersion: pipecd.dev/v1beta1
kind: Piped
spec:
  projectID: ***
  pipedID: ***
  pipedKeyData: ***
  apiAddress: ***
  git: ***
  repositories: ***
  plugins:
    - name: kubernetes
      port: 7001
      url: oci://localhost:5001/piped-kubernetes:latest
      deployTargets:
        - name: local-k8s
          config:
            kubeConfigPath: ***
    - name: wait
      port: 7002
      url: oci://localhost:5001/piped-wait:latest

Before trying the config above, we have to patch the below lines to include the option oci.WithInsecure() because the local registry hosts the HTTP protocol, not the HTTPS protocol.

if err := oci.PullFileFromRegistry(
ctx,
destDir,
tmpFile,
sourceURL,
oci.WithTargetOS(runtime.GOOS),
oci.WithTargetArch(runtime.GOARCH),
oci.WithMediaType(oci.MediaTypePipedPlugin),

Why we need it:

We want to support OCI Registry in hosting a piped plugin.

Which issue(s) this PR fixes:

Part of #4980

Does this PR introduce a user-facing change?: No

  • How are users affected by this change:
  • Is this breaking change:
  • How to migrate (if breaking change):

Warashi added 9 commits April 25, 2025 11:04
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Copy link

codecov bot commented Apr 25, 2025

Codecov Report

Attention: Patch coverage is 26.00000% with 74 lines in your changes missing coverage. Please review.

Project coverage is 27.17%. Comparing base (9cc2355) to head (f1bc430).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
pkg/app/pipectl/cmd/plugin/push.go 30.86% 56 Missing ⚠️
pkg/app/pipectl/cmd/plugin/plugin.go 0.00% 12 Missing ⚠️
pkg/oci/push.go 25.00% 2 Missing and 1 partial ⚠️
pkg/configv1/piped.go 0.00% 2 Missing ⚠️
cmd/pipectl/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5779      +/-   ##
==========================================
- Coverage   27.17%   27.17%   -0.01%     
==========================================
  Files         507      509       +2     
  Lines       53423    53521      +98     
==========================================
+ Hits        14520    14546      +26     
- Misses      37796    37867      +71     
- Partials     1107     1108       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Warashi Warashi marked this pull request as ready for review April 25, 2025 02:55
Copy link
Member

@ffjlabo ffjlabo left a comment

Choose a reason for hiding this comment

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

Let's try

@Warashi Warashi merged commit ee54480 into master May 8, 2025
18 of 19 checks passed
@Warashi Warashi deleted the pipectl-push-plugin-to-oci branch May 8, 2025 00:14
@github-actions github-actions bot mentioned this pull request May 15, 2025
@github-actions github-actions bot mentioned this pull request May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants