Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 5 additions & 13 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@ jobs:
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.16.2'
- name: run unit tests
run: make test
- name: run acceptance tests
run: |
export LOCAL_REGISTRY_HOSTNAME="$(hostname -I | awk '{print $1}')"
make acceptance
- name: upload coverage report
uses: actions/upload-artifact@master
with:
name: oras-coverage-report-${{ github.sha }}
path: .cover/
if: always()
go-version: '1.16.3'
- name: Build CLI
run: make build-linux
- name: Check version
run: bin/linux/amd64/oras version
18 changes: 5 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ jobs:
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.16.2'
- name: run unit tests
run: make test
- name: run acceptance tests
run: |
export LOCAL_REGISTRY_HOSTNAME="$(hostname -I | awk '{print $1}')"
make acceptance
- name: upload coverage report
uses: actions/upload-artifact@master
with:
name: oras-coverage-report-${{ github.sha }}
path: .cover/
if: always()
go-version: '1.16.3'
- name: Build CLI
run: make build-linux
- name: Check version
run: bin/linux/amd64/oras version
2 changes: 1 addition & 1 deletion .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: setup go environment
uses: actions/setup-go@v1
with:
go-version: '1.16.2'
go-version: '1.16.3'
- name: run goreleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
70 changes: 0 additions & 70 deletions BUILDING.md

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM docker.io/library/golang:1.15.7-alpine as builder
FROM docker.io/library/golang:1.16.3-alpine as builder
RUN apk add git make
ENV ORASPKG /oras
ADD . ${ORASPKG}
WORKDIR ${ORASPKG}
RUN make build-linux
RUN mv ${ORASPKG}/bin/linux/amd64/oras /go/bin/oras

FROM docker.io/library/alpine:3.13.0
FROM docker.io/library/alpine:3.13.5
LABEL maintainer="shizh@microsoft.com"
RUN apk --update add ca-certificates
COPY --from=builder /go/bin/oras /bin/oras
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ LDFLAGS += -X $(PROJECT_PKG)/internal/version.GitTreeState=${GIT_DIRTY}

.PHONY: test
test: vendor check-encoding
./scripts/test.sh

.PHONY: acceptance
acceptance:
./scripts/acceptance.sh
echo "TODO: add unit tests"

.PHONY: covhtml
covhtml:
Expand Down
81 changes: 12 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/deislabs/oras)](https://goreportcard.com/report/github.com/deislabs/oras)
[![GoDoc](https://godoc.org/github.com/deislabs/oras?status.svg)](https://godoc.org/github.com/deislabs/oras)

![ORAS](./oras.png)
![ORAS](https://github.com/oras-project/oras-www/raw/main/docs/assets/images/oras.png)

[Registries are evolving as Cloud Native Artifact Stores](https://stevelasker.blog/2019/01/25/cloud-native-artifact-stores-evolve-from-container-registries/). To enable this goal, Microsoft has donated ORAS as a means to enable various client libraries with a way to push [OCI Artifacts][artifacts] to [OCI Conformant](https://github.com/opencontainers/oci-conformance) registries.

Expand Down Expand Up @@ -43,38 +43,38 @@ ORAS is both a [CLI](#oras-cli) for initial testing and a [Go Module](#oras-go-m
```sh
gofish install oras
==> Installing oras...
🐠 oras 0.11.1: installed in 65.131245ms
🐠 oras 0.12.0: installed in 65.131245ms
```

- Install from the latest [release artifacts](https://github.com/deislabs/oras/releases):

- Linux

```sh
curl -LO https://github.com/deislabs/oras/releases/download/v0.11.1/oras_0.11.1_linux_amd64.tar.gz
curl -LO https://github.com/deislabs/oras/releases/download/v0.12.0/oras_0.12.0_linux_amd64.tar.gz
mkdir -p oras-install/
tar -zxf oras_0.11.1_*.tar.gz -C oras-install/
tar -zxf oras_0.12.0_*.tar.gz -C oras-install/
mv oras-install/oras /usr/local/bin/
rm -rf oras_0.11.1_*.tar.gz oras-install/
rm -rf oras_0.12.0_*.tar.gz oras-install/
```

- macOS

```sh
curl -LO https://github.com/deislabs/oras/releases/download/v0.11.1/oras_0.11.1_darwin_amd64.tar.gz
curl -LO https://github.com/deislabs/oras/releases/download/v0.12.0/oras_0.12.0_darwin_amd64.tar.gz
mkdir -p oras-install/
tar -zxf oras_0.11.1_*.tar.gz -C oras-install/
tar -zxf oras_0.12.0_*.tar.gz -C oras-install/
mv oras-install/oras /usr/local/bin/
rm -rf oras_0.11.1_*.tar.gz oras-install/
rm -rf oras_0.12.0_*.tar.gz oras-install/
```

- Windows

Add `%USERPROFILE%\bin\` to your `PATH` environment variable so that `oras.exe` can be found.

```sh
curl.exe -sLO https://github.com/deislabs/oras/releases/download/v0.11.1/oras_0.11.1_windows_amd64.tar.gz
tar.exe -xvzf oras_0.11.1_windows_amd64.tar.gz
curl.exe -sLO https://github.com/deislabs/oras/releases/download/v0.12.0/oras_0.12.0_windows_amd64.tar.gz
tar.exe -xvzf oras_0.12.0_windows_amd64.tar.gz
mkdir -p %USERPROFILE%\bin\
copy oras.exe %USERPROFILE%\bin\
set PATH=%USERPROFILE%\bin\;%PATH%
Expand All @@ -85,7 +85,7 @@ ORAS is both a [CLI](#oras-cli) for initial testing and a [Go Module](#oras-go-m
A public Docker image containing the CLI is available on [GitHub Container Registry](https://github.com/orgs/deislabs/packages/container/package/oras):

```sh
docker run -it --rm -v $(pwd):/workspace ghcr.io/deislabs/oras:v0.11.1 help
docker run -it --rm -v $(pwd):/workspace ghcr.io/deislabs/oras:v0.12.0 help
```

> Note: the default WORKDIR in the image is `/workspace`.
Expand Down Expand Up @@ -254,64 +254,7 @@ oras pull localhost:5000/hello:latest

## ORAS Go Module

While the ORAS CLI provides a great way to get started, and test registry support for [OCI Artifacts][artifacts], the primary experience enables a native experience for your artifact of choice. Using the ORAS Go Module, you can develop your own push/pull experience: `myclient push artifacts.azurecr.io/myartifact:1.0 ./mything.thang`

The package `github.com/deislabs/oras/pkg/oras` can quickly be imported in other Go-based tools that
wish to benefit from the ability to store arbitrary content in container registries.

### ORAS Go Module Example

[Source](examples/simple_push_pull.go)

```go
package main

import (
"context"
"fmt"

"github.com/deislabs/oras/pkg/content"
"github.com/deislabs/oras/pkg/oras"

"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/oras: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 := oras.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 = oras.Pull(ctx, resolver, ref, fileStore, oras.WithAllowedMediaTypes(allowedMediaTypes))
check(err)
fmt.Printf("Pulled from %s with digest %s\n", ref, desc.Digest)
fmt.Printf("Try running 'cat %s'\n", fileName)
}
```
See https://github.com/oras-project/oras-go

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"

orascontent "github.com/deislabs/oras/pkg/content"
orascontent "github.com/oras-project/oras-go/pkg/content"

"github.com/containerd/containerd/content"
"github.com/containerd/containerd/content/local"
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"strings"

auth "github.com/deislabs/oras/pkg/auth/docker"
auth "github.com/oras-project/oras-go/pkg/auth/docker"

"github.com/docker/docker/pkg/term"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"context"

auth "github.com/deislabs/oras/pkg/auth/docker"
auth "github.com/oras-project/oras-go/pkg/auth/docker"

"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"os"

"github.com/deislabs/oras/pkg/content"
ctxo "github.com/deislabs/oras/pkg/context"
"github.com/deislabs/oras/pkg/oras"
"github.com/oras-project/oras-go/pkg/content"
ctxo "github.com/oras-project/oras-go/pkg/context"
"github.com/oras-project/oras-go/pkg/oras"

"github.com/containerd/containerd/reference"
"github.com/sirupsen/logrus"
Expand Down
6 changes: 3 additions & 3 deletions cmd/oras/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"path/filepath"

"github.com/deislabs/oras/pkg/content"
ctxo "github.com/deislabs/oras/pkg/context"
"github.com/deislabs/oras/pkg/oras"
"github.com/oras-project/oras-go/pkg/content"
ctxo "github.com/oras-project/oras-go/pkg/context"
"github.com/oras-project/oras-go/pkg/oras"

ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/sirupsen/logrus"
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
"os"

auth "github.com/deislabs/oras/pkg/auth/docker"
auth "github.com/oras-project/oras-go/pkg/auth/docker"

"github.com/containerd/containerd/remotes"
"github.com/containerd/containerd/remotes/docker"
Expand Down
9 changes: 0 additions & 9 deletions docs/README.md

This file was deleted.

Loading