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

Github Access method #36

Merged
merged 5 commits into from
Aug 8, 2022
Merged

Github Access method #36

merged 5 commits into from
Aug 8, 2022

Conversation

Skarlso
Copy link
Contributor

@Skarlso Skarlso commented Aug 2, 2022

What this PR does / why we need it:

Which issue(s) this PR fixes:
Fixes #20

Special notes for your reviewer:

The following things have been changed:

  • The identityMatcher for hostname has been extracted so it can be re-used
  • Added a new accessmethod type github

The following manual test has been applied:

resources.yaml

name: 'server'
version: '0.0.1'
type: 'filesystem'
relation: 'external'
access:
  type: 'github'
  owner: 'Skarlso'
  repository: 'test'
  commit: '7b1445755ee2527f0bf80ef9eeb59a5d2e6e3e1f'

Then try downloading resources with this patch using the following component descriptor:

component:
  componentReferences: []
  name: github.com/skarlso/ocm-test
  provider: skarlso
  repositoryContexts: []
  resources:
  - access:
      commit: 7b1445755ee2527f0bf80ef9eeb59a5d2e6e3e1f
      owner: Skarlso
      repository: test
      type: github
    name: server-public
    relation: external
    type: filesystem
    version: 0.0.1
  - access:
      commit: a5905000afbc7abbb55df6c51534b47e373bcd7d
      owner: Skarlso
      repository: private-test
      type: github
    name: server-private
    relation: external
    type: filesystem
    version: 0.0.1
  sources: []
  version: 0.0.1
meta:
  schemaVersion: v2

Using the following command:

ocm --cred :type=github --cred :hostname=github.com --cred token=${GITHUB_TOKEN} download resources ocm-test
github.com/skarlso/ocm-test/0.0.1/server-public: 1594 byte(s) written
github.com/skarlso/ocm-test/0.0.1/server-private: 272 byte(s) written

Update the github paths accordingly and set GITHUB_TOKEN environment property.

Release note:

@gardener-robot
Copy link
Contributor

@Skarlso Thank you for your contribution.

@Skarlso Skarlso force-pushed the github_access_method branch from d6c5c68 to b6bba92 Compare August 2, 2022 07:58
@Skarlso
Copy link
Contributor Author

Skarlso commented Aug 2, 2022

Output for make test:

make test
?   	github.com/open-component-model/ocm/cmds/ocm	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/app	1.314s
?   	github.com/open-component-model/ocm/cmds/ocm/clictx	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/clictx/config	0.719s
?   	github.com/open-component-model/ocm/cmds/ocm/clictx/core	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/clean	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/info	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/cachecmds/names	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/common/options/closureoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/common/options/destoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/common/options/formatoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/misccmds/credentials	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/misccmds/credentials/get	1.740s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/misccmds/names	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/misccmds/rsakeypair	1.747s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/artefacts	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/artefacts/describe	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/artefacts/download	3.706s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/artefacts/get	3.421s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/artefacts/transfer	2.360s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/common	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/common/handlers/artefacthdlr	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/common/options/repooption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/ctf	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/ctf/create	2.667s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/names	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/tags	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocicmds/tags/show	3.116s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common	3.789s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/cmds/signing	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/handlers/comphdlr	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/handlers/elemhdlr	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs	2.990s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/cpi	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/directory	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/docker	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/file	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/inputs/types/helm	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/comppathopt	2.712s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/lookupoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/overwriteoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/repooption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/rscbyvalueoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/schemaoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/scriptoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/signoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/common/options/srcbyvalueoption	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/componentarchive	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/componentarchive/create	1.233s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/componentarchive/transfer	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/components	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/components/download	1.669s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/components/get	1.529s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/components/sign	2.704s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/components/transfer	2.533s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/components/verify	2.804s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/ctf	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/ctf/transfer	3.013s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/names	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/references	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/references/add	2.267s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/references/common	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/references/get	3.124s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/resources	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/resources/add	2.957s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/resources/common	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/resources/download	1.909s
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/resources/get	1.499s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/sources	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/sources/add	1.499s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/sources/common	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/sources/get	1.801s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/versions	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/commands/ocmcmds/versions/show	2.179s
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/add	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/clean	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/create	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/describe	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/download	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/get	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/show	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/sign	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/transfer	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/commands/verbs/verify	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/pkg/cobrautils	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/pkg/data	1.514s
ok  	github.com/open-component-model/ocm/cmds/ocm/pkg/options	1.892s
ok  	github.com/open-component-model/ocm/cmds/ocm/pkg/output	2.020s
ok  	github.com/open-component-model/ocm/cmds/ocm/pkg/processing	2.165s
ok  	github.com/open-component-model/ocm/cmds/ocm/pkg/template	2.381s
?   	github.com/open-component-model/ocm/cmds/ocm/pkg/tree	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/pkg/utils	[no test files]
ok  	github.com/open-component-model/ocm/cmds/ocm/testhelper	1.654s
?   	github.com/open-component-model/ocm/cmds/ocm/topics/common/config	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/topics/oci/refs	[no test files]
?   	github.com/open-component-model/ocm/cmds/ocm/topics/ocm/refs	[no test files]
ok  	github.com/open-component-model/ocm/pkg/common	1.993s
ok  	github.com/open-component-model/ocm/pkg/common/accessio	1.806s
?   	github.com/open-component-model/ocm/pkg/common/accessobj	[no test files]
ok  	github.com/open-component-model/ocm/pkg/common/compression	1.282s
ok  	github.com/open-component-model/ocm/pkg/contexts/config	0.935s
ok  	github.com/open-component-model/ocm/pkg/contexts/config/config	0.900s
?   	github.com/open-component-model/ocm/pkg/contexts/config/core	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/config/cpi	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials	0.918s
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/config	1.342s
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/core	1.485s
?   	github.com/open-component-model/ocm/pkg/contexts/credentials/cpi	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/identity/hostpath	1.494s
?   	github.com/open-component-model/ocm/pkg/contexts/credentials/repositories	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/repositories/aliases	1.562s
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/repositories/directcreds	1.553s
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/repositories/dockerconfig	1.687s
ok  	github.com/open-component-model/ocm/pkg/contexts/credentials/repositories/memory	1.779s
?   	github.com/open-component-model/ocm/pkg/contexts/datacontext	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/datacontext/config	1.325s
?   	github.com/open-component-model/ocm/pkg/contexts/datacontext/vfsattr	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci	1.136s
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/artdesc	0.987s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/artdesc/helper	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/attrs	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/attrs/cacheattr	1.657s
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/config	1.201s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/core	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/cpi	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/grammar	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/identity	0.980s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/ociutils	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/ociutils/helm	1.495s
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/ociutils/helm/ignore	0.761s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/ociutils/helm/loader	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/ociutils/helm/sympath	1.275s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/repositories	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/artefactset	0.939s
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ctf	0.941s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ctf/format	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ctf/index	0.549s
?   	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ctf/testhelper	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/docker	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/empty	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/repositories/ocireg	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/oci/transfer	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm	1.277s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/github	1.385s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localblob	1.614s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localfsblob	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/localociblob	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/none	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociblob	2.131s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/accessmethods/ociregistry	2.229s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/attrs	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/attrs/compatattr	2.157s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/attrs/keepblobattr	2.131s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/attrs/signingattr	2.120s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/blobhandler	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/blobhandler/oci	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/blobhandler/oci/ocirepo	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/blobhandler/ocm	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/blobhandler/ocm/comparch	1.406s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc	1.868s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/meta/v1	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/normalizations	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/normalizations/jsonv1	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/normalizations/jsonv2	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/ocm.gardener.cloud/v3alpha1	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/ocm.gardener.cloud/v3alpha1/jsonscheme	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/v2	1.198s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/compdesc/versions/v2/jsonscheme	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/config	1.103s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/core	2.193s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/cpi	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/cpi/support	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/digester/digesters	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/digester/digesters/artefact	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/download	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/download/handlers	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/download/handlers/blob	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/download/handlers/helm	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/grammar	1.237s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/repositories	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/comparch	1.242s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/ctf	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/genericocireg	1.625s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/genericocireg/componentmapping	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/repositories/ocireg	[no test files]
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/resourcetypes	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/signing	4.653s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/transfer	1.352s
?   	github.com/open-component-model/ocm/pkg/contexts/ocm/transfer/transferhandler	[no test files]
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/transfer/transferhandler/spiff	1.951s
ok  	github.com/open-component-model/ocm/pkg/contexts/ocm/transfer/transferhandler/standard	2.287s
?   	github.com/open-component-model/ocm/pkg/docker	[no test files]
ok  	github.com/open-component-model/ocm/pkg/env	1.729s
?   	github.com/open-component-model/ocm/pkg/env/builder	[no test files]
ok  	github.com/open-component-model/ocm/pkg/errors	1.187s
?   	github.com/open-component-model/ocm/pkg/mime	[no test files]
?   	github.com/open-component-model/ocm/pkg/out	[no test files]
?   	github.com/open-component-model/ocm/pkg/regex	[no test files]
ok  	github.com/open-component-model/ocm/pkg/runtime	1.360s
ok  	github.com/open-component-model/ocm/pkg/signing	2.569s
?   	github.com/open-component-model/ocm/pkg/signing/handlers	[no test files]
?   	github.com/open-component-model/ocm/pkg/signing/handlers/rsa	[no test files]
?   	github.com/open-component-model/ocm/pkg/signing/handlers/rsa-signingservice	[no test files]
?   	github.com/open-component-model/ocm/pkg/signing/hasher	[no test files]
?   	github.com/open-component-model/ocm/pkg/signing/hasher/nodigest	[no test files]
?   	github.com/open-component-model/ocm/pkg/signing/hasher/sha256	[no test files]
?   	github.com/open-component-model/ocm/pkg/signing/hasher/sha512	[no test files]
ok  	github.com/open-component-model/ocm/pkg/test/json_orig	1.498s
ok  	github.com/open-component-model/ocm/pkg/utils	1.107s
?   	github.com/open-component-model/ocm/pkg/utils/selector	[no test files]
?   	github.com/open-component-model/ocm/pkg/version	[no test files]

@Skarlso Skarlso requested a review from mandelsoft August 2, 2022 11:18
@Skarlso Skarlso force-pushed the github_access_method branch from 06c933a to c0863c2 Compare August 2, 2022 11:34
pkg/contexts/ocm/accessmethods/github/method.go Outdated Show resolved Hide resolved
)

// Type is the access type of GitHub registry.
const Type = "github"
Copy link
Contributor

Choose a reason for hiding this comment

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

use GitHub

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That contradicts with other types like ociRegistry, not? If we call this GitHub should we call the others like OCIRegistry?

Copy link
Contributor

Choose a reason for hiding this comment

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

Potentially,

so far the Consumer type for OCI is also complete Camel Case, while the access method types always start with a lower case letter.

We have to decide, whether we want to stick to this or align it.

Another related problem:
The convention for labelling Matcher types is as follows:

  • by default a matcher with the label of the comsumer type is used
  • there are non-consumer type matchers that use lower case names to not conflict with consumer types.

So, if we decide to use lower case consumer types. we have to look for another way to distinguish them form the non consumer type matchers.

pkg/contexts/ocm/accessmethods/github/method.go Outdated Show resolved Hide resolved
@Skarlso Skarlso requested a review from mandelsoft August 2, 2022 14:50
pkg/contexts/ocm/accessmethods/github/method_test.go Outdated Show resolved Hide resolved

When("the commit sha is of the right length but contains invalid characters", func() {
It("errors", func() {
accessMethod := ocmgithub.New(
Copy link
Contributor

Choose a reason for hiding this comment

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

see above

Expect(err).To(MatchError(ContainSubstring("commit contains invalid characters for a SHA")))
})
})
})
Copy link
Contributor

@mandelsoft mandelsoft Aug 3, 2022

Choose a reason for hiding this comment

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

just to be complete, you could add some test passing credentials:

  • create a local credentials context
  • compose an oci context using this
  • compose an ocm context using these
  • set credentials for a consumer
  • and check whether the credentials reach the downloader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Agreed, I'm actually working on that right now. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sort of done.

To outline the problem would take too long, but basically, the http client is buried in the github library and cannot be nicely mocked out unless I do something in the production code, which is not okay.

Even if I try setting up some RoundTrip mocks, the oauth2 will override that and ignore the base if another token provider exist.

Therefor, we only verify that the cred is being called at least and check what happens when it errors.

@Skarlso Skarlso force-pushed the github_access_method branch 4 times, most recently from 49ecfdd to 265143d Compare August 3, 2022 13:16
@mandelsoft mandelsoft merged commit f114b1c into master Aug 8, 2022
@yitsushi yitsushi mentioned this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Gap closing][Feature Parity] Add github access method to ocm
3 participants