Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Migrate oras Go libraries to libs-go/ #28

Closed
wants to merge 151 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
3d0a284
Initial commit
shizhMSFT Dec 24, 2018
5d3d63f
Add vendor
shizhMSFT Dec 24, 2018
6ba6877
update git ignore
shizhMSFT Dec 24, 2018
3c8ea00
Add OCI Push
shizhMSFT Dec 24, 2018
523bae1
initial unit tests
jdolitsky Dec 24, 2018
6990850
Merge pull request #1 from jdolitsky/add-unit-tests
shizhMSFT Dec 25, 2018
673850c
add pull (#2)
shizhMSFT Dec 25, 2018
49276ca
Update README.md
shizhMSFT Dec 25, 2018
d12f96d
Fix schema version
shizhMSFT Dec 25, 2018
d3e1395
Add Command Line Tools (#3)
shizhMSFT Dec 26, 2018
210c280
Update vendor
shizhMSFT Dec 26, 2018
e8c05e6
support explicit specifying token
shizhMSFT Dec 26, 2018
906089e
Add usage to readme
shizhMSFT Dec 26, 2018
8e4754e
Add Dockerfile support
shizhMSFT Dec 26, 2018
06998c9
add verbose output
shizhMSFT Dec 26, 2018
6c158b1
Add debug mode
shizhMSFT Dec 26, 2018
0155202
fix dependency issues for tests
jdolitsky Dec 26, 2018
cdaf728
disable cgo for tests
jdolitsky Dec 26, 2018
4bce704
lock bugsnag lib
jdolitsky Dec 26, 2018
0f6b55a
Merge pull request #4 from jdolitsky/add-unit-tests
jdolitsky Dec 26, 2018
5042f56
push real contents test
jdolitsky Dec 26, 2018
faacbbf
use new resolver every push
jdolitsky Dec 26, 2018
b49b009
add pull tests
jdolitsky Dec 26, 2018
ba1be85
fix order of test methods
jdolitsky Dec 27, 2018
6d91858
verify pulled files
jdolitsky Dec 27, 2018
a989514
add docker/distribution to gopkg.toml
jdolitsky Dec 27, 2018
26918fc
Merge pull request #5 from jdolitsky/add-unit-tests
jdolitsky Dec 27, 2018
ab45179
not download unsupported files (#6)
shizhMSFT Dec 27, 2018
e8f753d
fix path (#7)
shizhMSFT Dec 27, 2018
4fcce65
example of how to use as module
jdolitsky Dec 27, 2018
2bd9147
Merge pull request #8 from jdolitsky/readme-updates
jdolitsky Dec 27, 2018
a6eaed3
add release instructions
jdolitsky Dec 27, 2018
506d9af
add install instructions
jdolitsky Dec 27, 2018
f84587c
Merge pull request #9 from jdolitsky/install-instructions
jdolitsky Dec 27, 2018
03d5245
correct link for windows release
jdolitsky Dec 27, 2018
a248a3e
refactor code (#10)
shizhMSFT Dec 28, 2018
f821cfa
Add reportcard and godoc (#11)
jdolitsky Dec 28, 2018
982e6d0
Add CI pipelines (#12)
jdolitsky Dec 28, 2018
7d8f05c
small readme update (#13)
jdolitsky Dec 28, 2018
73bedce
push oras docker image (#15)
jdolitsky Dec 28, 2018
8088466
allow specifying media type (#14)
shizhMSFT Dec 28, 2018
5f50a43
Update README.md (#16)
jdolitsky Dec 28, 2018
cf59c2b
fix race condition (#17)
shizhMSFT Dec 28, 2018
3e12356
Changes for 0.2.0 release (#18)
jdolitsky Dec 28, 2018
01173ad
Add docs on new flags (#19)
jdolitsky Dec 28, 2018
b6df2ad
fix readme typo (#23)
jdolitsky Jan 4, 2019
c4f2a91
push to / pull from content store (#21)
shizhMSFT Jan 4, 2019
9499859
pkg/content unit tests (#24)
jdolitsky Jan 7, 2019
27c7890
readme to reflect 0.3.0 release (#25)
jdolitsky Jan 7, 2019
8fec61f
several documentation updates (#29)
jdolitsky Jan 9, 2019
81834b8
windows install doc update (#30)
jdolitsky Jan 9, 2019
a12f2e7
change release tarball bianry path (#31)
jdolitsky Jan 9, 2019
4cf1be7
Enhance security on FileStore (#33)
shizhMSFT Jan 10, 2019
05d0b39
overwrite by default (#34)
shizhMSFT Jan 10, 2019
147c927
readme update for 0.3.2 (#35)
jdolitsky Jan 10, 2019
ff5d285
replace shizhMSFT with deislabs (#40)
shizhMSFT Jan 23, 2019
cf7fd54
Update license to MIT (#42)
lachie83 Jan 23, 2019
4f5a2fb
Prep for public access (#46)
SteveLasker Jan 25, 2019
f5f3c4d
Update README.md (#47)
SteveLasker Jan 25, 2019
e8a1fa6
prep for 0.3.3 release (#48)
jdolitsky Jan 25, 2019
119277a
fix(deps): fix forked dependencies (#51)
adamreese Jan 31, 2019
60f514a
Customized Config and Annotations Support (#56)
shizhMSFT Apr 11, 2019
c940067
Update dependency (#61)
shizhMSFT Apr 11, 2019
1829eb0
Support oras login (#53)
shizhMSFT Apr 11, 2019
12b336a
Add readme on login/logout (#60)
jdolitsky Apr 11, 2019
c71f94e
Directory Support (#55)
shizhMSFT Apr 15, 2019
8f6cd04
Cross-platform support on path (#65)
shizhMSFT Apr 15, 2019
212c034
Default path validation on push (#66)
shizhMSFT Apr 15, 2019
bc1ed35
Logout returns error if not logged in (#73)
shizhMSFT Apr 17, 2019
bf2ff5d
oras version (#69)
shizhMSFT Apr 17, 2019
550ed34
Push/Pull return the descriptor of the associated tag (#70)
shizhMSFT Apr 17, 2019
d1e0198
Discard logger (#80)
shizhMSFT Apr 18, 2019
40d2096
Allow sequential pulling with break in the middle (#83)
shizhMSFT Apr 18, 2019
4223f0b
Better UX on Push / Pull (#84)
shizhMSFT Apr 19, 2019
c2faeab
Human friendly errror output (#85)
shizhMSFT Apr 19, 2019
907ae72
add logo (#82)
jdolitsky Apr 19, 2019
be4822f
Encoding check (#87)
jdolitsky Apr 19, 2019
9f76690
prep for 0.4.0 release
jdolitsky Apr 19, 2019
39de067
fix bug (#93)
shizhMSFT Apr 30, 2019
691760d
opt to change config media type (#95)
shizhMSFT May 6, 2019
7406cb4
Documentations (#96)
shizhMSFT May 6, 2019
e903bf0
move to gomodules (#100)
May 6, 2019
a2d2b59
Update to latest docker/cli dependency version (#101)
jdolitsky May 9, 2019
b3b6ce7
prep for 0.5.0 release
jdolitsky May 10, 2019
2836a43
update goreleaser version in release pipeline
jdolitsky May 10, 2019
0c42bf5
Update README.md (#103)
jdolitsky May 16, 2019
b285197
New OCIStore (#108)
shizhMSFT Aug 9, 2019
d56ebb9
Add insecure flag when login registry (#110)
pytimer Aug 19, 2019
3c30fc8
Add --insecure flag usage document in readme (#113)
pytimer Aug 25, 2019
7467008
Update to containerd v1.3.0 (beta.2+) (#116)
jdolitsky Aug 26, 2019
4129956
Fix typo (#121)
estesp Aug 30, 2019
1edc74f
Added unknown config mediaType (#119)
sajayantony Aug 30, 2019
281ff98
Adding Shiwei github handle (#123)
SteveLasker Sep 2, 2019
a5f65f3
Docker Hub now supports OCI images (#127)
justincormack Oct 3, 2019
ea5c23a
Readme formatting (#128)
SteveLasker Oct 4, 2019
205efe3
Allow overriding the manifestdescriptor when pushing (#133)
ecordell Oct 14, 2019
bbe4258
Add insecure and plain-http flag when pull and push (#122)
pytimer Oct 17, 2019
c038679
Update module file for 1.13 (#132)
jpreese Oct 17, 2019
eda7eb2
Revert "Update module file for 1.13 (#132)" (#134)
jdolitsky Oct 17, 2019
5229f7a
Update oras modules and pipelines (#135)
jpreese Oct 29, 2019
ea09e1e
oras-143 updating mediaType in example in README (#144)
zendril Nov 29, 2019
93c4cc2
add option to strip file times to make tarballs more reproducible (#126)
mxey Jan 22, 2020
237ac92
Upgrade to containerd 1.3.2, prep 0.8.1 release (#146)
jdolitsky Feb 3, 2020
fb588f7
Enable ARM64 linux builds. (#152)
sajayantony Mar 3, 2020
19a0d44
Allow empty artifact (#154)
shizhMSFT Mar 6, 2020
e227ad1
fix typo in BUILDING.md (#158)
May 5, 2020
16f59e3
reducing maintainers (#162)
SteveLasker Jun 5, 2020
2f7ca83
Proposal to add Vincent Batts as a maintainer of ORAS (#163)
SteveLasker Jun 11, 2020
c4facb5
Readme content updates, prepping for OCI adoption (#164)
SteveLasker Jun 12, 2020
3a7c320
update doc for go mod (#168)
shizhMSFT Jun 15, 2020
e68c514
Refactor docker/NewClient to use early return (#169)
KeisukeYamashita Jun 30, 2020
d19ad98
Remove dependency on k8s.io/kubernetes (#175)
howardjohn Sep 10, 2020
eeb3b5f
docs: add ECR docs (#174)
RichiCoder1 Sep 10, 2020
73b72c5
bump up version of docker depdendency (#180)
reasonerjt Sep 28, 2020
ad8a2d6
Add GitHub Actions CI (#183)
jdolitsky Oct 1, 2020
78a9b6b
move reporting of status to lib (#179)
deitch Oct 1, 2020
6414398
add gar doc (#184)
hideto0710 Oct 2, 2020
d1f055b
create pass-through writer and iowriter (#182)
deitch Oct 27, 2020
79a6cf6
chore(deps): add dependabot.yml (#185)
ylz-at Oct 27, 2020
4cae1db
gunzip and untar passthrough writers (#191)
deitch Oct 28, 2020
2ca9464
options to content writers, including pre-providing the input and out…
deitch Nov 9, 2020
d2037e9
Fix broken OCI blog link in readme (#195)
jinghzhu Nov 10, 2020
f1caa17
prevent anyone from accidentally setting the blocksize to zero (#197)
deitch Nov 10, 2020
ff65769
Bump github.com/opencontainers/go-digest from 1.0.0-rc1 to 1.0.0 (#186)
dependabot[bot] Nov 12, 2020
da7584b
Bump github.com/sirupsen/logrus from 1.4.2 to 1.7.0 (#187)
dependabot[bot] Nov 12, 2020
63f4762
Bump github.com/stretchr/testify from 1.4.0 to 1.6.1 (#188)
dependabot[bot] Nov 12, 2020
b489434
Bump github.com/spf13/cobra from 0.0.5 to 0.0.7 (#189)
dependabot[bot] Nov 12, 2020
a64b0ac
Bump github.com/containerd/containerd from 1.3.2 to 1.4.1 (#190)
dependabot[bot] Nov 12, 2020
f7447b4
maint: update CI branch to main
jdolitsky Nov 12, 2020
0bffdbc
add optional decompressstore (#198)
deitch Nov 17, 2020
9555bb8
add multireader (#199)
deitch Nov 17, 2020
50141da
Bump github.com/containerd/containerd from 1.4.1 to 1.4.3 (#202)
dependabot[bot] Dec 1, 2020
9a978bb
oras pull with cache (#203)
shizhMSFT Dec 12, 2020
d3683ca
Fix `pkg/auth/docker` test (#204)
shizhMSFT Dec 14, 2020
07b7182
Bump github.com/stretchr/testify from 1.6.1 to 1.7.0 (#206)
dependabot[bot] Jan 21, 2021
ee4d00f
prep for v0.9.0 release (#209)
jdolitsky Jan 22, 2021
a71cd72
use armored signatures (#210)
jdolitsky Jan 22, 2021
4891e69
maint: prep for v0.9.0 release
jdolitsky Jan 22, 2021
ccd6d00
maint: fix makefile signatures
jdolitsky Jan 22, 2021
200d032
maint: bump internal version to 0.9.0
jdolitsky Jan 22, 2021
96cd904
Merge pull request from GHSA-g5v4-5x39-vwhx
shizhMSFT Jan 22, 2021
b4a877c
multiwriteringester support (#214)
deitch Feb 4, 2021
b95c322
Fix OCIStore inconsistent state after AddReference (#215)
distorhead Feb 4, 2021
84cf587
Bump github.com/docker/cli (#216)
dependabot[bot] Feb 4, 2021
173c010
maint: bump internal version to 0.10.0
jdolitsky Feb 4, 2021
38788d6
actual versions in go.mod (#218)
deitch Feb 9, 2021
8804da3
Merge remote-tracking branch 'oras/main'
jdolitsky Feb 9, 2021
c182305
move oras code to libs-go, remove CLI-related thigs
jdolitsky Feb 9, 2021
053eb6f
run CI on current branch
jdolitsky Feb 9, 2021
b665efc
Remove references to deislabs or oras
jdolitsky Feb 9, 2021
a7a868e
Only run CI for main branch
jdolitsky Feb 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

updates:
- package-ecosystem: "gomod"
directory: "libs-go"
schedule:
interval: "daily"
24 changes: 24 additions & 0 deletions .github/workflows/build-libs-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build-libs-go

on:
push:
branches: main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.15.7'
- name: run unit tests
run: cd libs-go/ && make test
- name: upload coverage report
uses: actions/upload-artifact@master
with:
name: artifacts-libs-go-coverage-report-${{ github.sha }}
path: libs-go/.cover/
if: always()
25 changes: 25 additions & 0 deletions .github/workflows/build-pr-libs-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: build-pr-libs-go

on:
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.15.7'
- name: run unit tests
run: cd libs-go/ && make test
- name: upload coverage report
uses: actions/upload-artifact@master
with:
name: artifacts-libs-go-coverage-report-${{ github.sha }}
path: libs-go/.cover/
if: always()
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
.vscode/
26 changes: 26 additions & 0 deletions libs-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# VS Code
.vscode
debug

# Jetbrains
.idea

# Custom
.cover/
.test/
hello.txt
*.tar.gz
vendor/
25 changes: 25 additions & 0 deletions libs-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.PHONY: test
test: vendor check-encoding
./scripts/test.sh

.PHONY: covhtml
covhtml:
open .cover/coverage.html

.PHONY: clean
clean:
git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf

.PHONY: check-encoding
check-encoding:
! find pkg examples -name "*.go" -type f -exec file "{}" ";" | grep CRLF
! find scripts -name "*.sh" -type f -exec file "{}" ";" | grep CRLF

.PHONY: fix-encoding
fix-encoding:
find pkg examples -type f -name "*.go" -exec sed -i -e "s/\r//g" {} +
find scripts -type f -name "*.sh" -exec sed -i -e "s/\r//g" {} +

.PHONY: vendor
vendor:
GO111MODULE=on go mod vendor
57 changes: 57 additions & 0 deletions libs-go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# OCI Artifacts Go Libraries

[![GitHub Actions status](https://github.com/bloodorangeio/artifacts/workflows/build-libs-go/badge.svg)](https://github.com/bloodorangeio/artifacts/actions?query=workflow%3Abuild-libs-go)

## Example Usage

[Source](examples/simple_push_pull.go)

```go
package main

import (
"context"
"fmt"

"github.com/opencontainers/artifacts/libs-go/pkg/artifacts"
"github.com/opencontainers/artifacts/libs-go/pkg/content"

"github.com/containerd/containerd/remotes/docker"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

func check(e error) {
if e != nil {
panic(e)
}
}

func main() {
ref := "localhost:5000/artifacts:test"
fileName := "hello.txt"
fileContent := []byte("Hello World!\n")
customMediaType := "my.custom.media.type"

ctx := context.Background()
resolver := docker.NewResolver(docker.ResolverOptions{})

// Push file(s) w custom mediatype to registry
memoryStore := content.NewMemoryStore()
desc := memoryStore.Add(fileName, customMediaType, fileContent)
pushContents := []ocispec.Descriptor{desc}
fmt.Printf("Pushing %s to %s...\n", fileName, ref)
desc, err := artifacts.Push(ctx, resolver, ref, memoryStore, pushContents)
check(err)
fmt.Printf("Pushed to %s with digest %s\n", ref, desc.Digest)

// Pull file(s) from registry and save to disk
fmt.Printf("Pulling from %s and saving to %s...\n", ref, fileName)
fileStore := content.NewFileStore("")
defer fileStore.Close()
allowedMediaTypes := []string{customMediaType}
desc, _, err = artifacts.Pull(ctx, resolver, ref, fileStore, artifacts.WithAllowedMediaTypes(allowedMediaTypes))
check(err)
fmt.Printf("Pulled from %s with digest %s\n", ref, desc.Digest)
fmt.Printf("Try running 'cat %s'\n", fileName)
}
```
47 changes: 47 additions & 0 deletions libs-go/examples/simple_push_pull.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package main

import (
"context"
"fmt"

"github.com/opencontainers/artifacts/libs-go/pkg/artifacts"
"github.com/opencontainers/artifacts/libs-go/pkg/content"

"github.com/containerd/containerd/remotes/docker"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

func check(e error) {
if e != nil {
panic(e)
}
}

func main() {
ref := "localhost:5000/artifacts:test"
fileName := "hello.txt"
fileContent := []byte("Hello World!\n")
customMediaType := "my.custom.media.type"

ctx := context.Background()
resolver := docker.NewResolver(docker.ResolverOptions{})

// Push file(s) w custom mediatype to registry
memoryStore := content.NewMemoryStore()
desc := memoryStore.Add(fileName, customMediaType, fileContent)
pushContents := []ocispec.Descriptor{desc}
fmt.Printf("Pushing %s to %s...\n", fileName, ref)
desc, err := artifacts.Push(ctx, resolver, ref, memoryStore, pushContents)
check(err)
fmt.Printf("Pushed to %s with digest %s\n", ref, desc.Digest)

// Pull file(s) from registry and save to disk
fmt.Printf("Pulling from %s and saving to %s...\n", ref, fileName)
fileStore := content.NewFileStore("")
defer fileStore.Close()
allowedMediaTypes := []string{customMediaType}
desc, _, err = artifacts.Pull(ctx, resolver, ref, fileStore, artifacts.WithAllowedMediaTypes(allowedMediaTypes))
check(err)
fmt.Printf("Pulled from %s with digest %s\n", ref, desc.Digest)
fmt.Printf("Try running 'cat %s'\n", fileName)
}
38 changes: 38 additions & 0 deletions libs-go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module github.com/opencontainers/artifacts/libs-go

go 1.15

replace (
// WARNING! Do NOT replace these without also replacing their lines in the `require` stanza below.
// These `replace` stanzas are IGNORED when this is imported as a library
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
github.com/docker/docker => github.com/moby/moby v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
)

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/Microsoft/hcsshim v0.8.14 // indirect
github.com/containerd/containerd v1.4.3
github.com/containerd/continuity v0.0.0-20210208174643-50096c924a4e // indirect
github.com/docker/cli v20.10.3+incompatible
github.com/docker/distribution v0.0.0-20191216044856-a8371794149d
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/docker/docker-credential-helpers v0.6.3 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.5.4 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.0.0
github.com/opencontainers/runc v0.1.1 // indirect
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.7.0
github.com/stretchr/testify v1.5.1
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
google.golang.org/grpc v1.35.0 // indirect
gotest.tools/v3 v3.0.3 // indirect
)
Loading