sdk icon indicating copy to clipboard operation
sdk copied to clipboard

[SM-1223] restructure Go wrapper for distribution

Open tangowithfoxtrot opened this issue 1 year ago • 4 comments

Type of change

  • [ ] Bug fix
  • [ ] New feature development
  • [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • [x] Build/deploy pipeline (DevOps)
  • [ ] Other

Objective

Restructure the Go wrapper so that it works when consumed as a package. The current structure uses "internal" Go modules, which will throw errors when you try to use them:

/go/pkg/mod/github.com/bitwarden/[email protected]/bitwarden_client.go:6:2: use of internal package github.com/bitwarden/sdk/languages/go/internal/cinterface not allowed

Code changes

  • file.ext: Description of what was changed and why

Before you submit

  • Please add unit tests where it makes sense to do so

tangowithfoxtrot avatar Mar 01 '24 22:03 tangowithfoxtrot

Logo Checkmarx One – Scan Summary & Detailsa5134412-489b-45ab-a21e-089c460785d5

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Unpinned Actions Full Length Commit SHA /release-go.yml: 62 Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps...

bitwarden-bot avatar Mar 01 '24 22:03 bitwarden-bot

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 60.53%. Comparing base (621cb48) to head (eb4f89a). Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #647   +/-   ##
=======================================
  Coverage   60.53%   60.53%           
=======================================
  Files         172      172           
  Lines       10527    10527           
=======================================
  Hits         6373     6373           
  Misses       4154     4154           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 01 '24 22:03 codecov[bot]

We also don't want to distribute the lib files in a repository unless we force puch every release. Since with the binaries occupying 30mb+ we can expect the repository size to quickly become unreasonable.

Hinton avatar Mar 04 '24 10:03 Hinton

We also don't want to distribute the lib files in a repository unless we force puch every release. Since with the binaries occupying 30mb+ we can expect the repository size to quickly become unreasonable.

That makes sense, but what's the alternative? Would we require people that want to import our Go wrapper to build the libs from source?

tangowithfoxtrot avatar Mar 04 '24 14:03 tangowithfoxtrot

I'm working on adding Bitwarden secrets manager as a provider to external secret operator for k8s and not being able to use this sdk as a package is a real deal breaker.

Do you have any recommendations on how this should be used in a multi architecture environment?

And the go example doesn't work, the Command struct is not imported

Thank you

sylwit avatar May 26 '24 05:05 sylwit