Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
efe151d
Initial prototype
shizhMSFT Jul 31, 2020
f494914
Distribution api proposal
SteveLasker Aug 15, 2020
230940d
Formating fix
SteveLasker Aug 15, 2020
945c02c
Formating fix
SteveLasker Aug 15, 2020
a42acd8
JWT based system (#16)
shizhMSFT Aug 19, 2020
02723c7
Update examples
SteveLasker Aug 24, 2020
7902d29
Fix extra curly bracket
SteveLasker Aug 24, 2020
a1b85a7
Fix extra curly bracket
SteveLasker Aug 24, 2020
f4765d1
Merge pull request #8 from shizhMSFT/main
SteveLasker Aug 26, 2020
cbd9bfa
Add examples of signing a multi-arch image
SteveLasker Aug 27, 2020
4e392ca
Fix paging api link
SteveLasker Aug 27, 2020
24207bb
Resolve spelling errors
SteveLasker Aug 31, 2020
276abe4
Fix examples to include full descriptor
SteveLasker Sep 1, 2020
6298cd2
typo feedback
SteveLasker Sep 17, 2020
578ecad
Renamed as options to keep as reference. Updated digest references
SteveLasker Sep 21, 2020
a3d6785
Merge pull request #10 from SteveLasker/distribution-proposal
SteveLasker Sep 21, 2020
73112f4
Doc and Demo updates
SteveLasker Mar 3, 2021
a5bac5d
Doc and Demo updates
SteveLasker Mar 3, 2021
3a6d3a6
nv2 demo script updates
SteveLasker Mar 3, 2021
a7ae4eb
nv2 demo: cleanup steps
SteveLasker Mar 3, 2021
24fc5c5
Prototype-2 initial mocks
SteveLasker Mar 10, 2021
9f54b68
Prototype-2 initial mocks
SteveLasker Mar 10, 2021
bc042ea
Merge pull request #42 from SteveLasker/prototype-2
SteveLasker Mar 19, 2021
7fbc45f
Use library implementation
shizhMSFT Mar 30, 2021
4a0a77d
converge docker-generate
shizhMSFT Mar 30, 2021
3d6c0a9
converge docker-nv2
shizhMSFT Mar 30, 2021
545280e
refactor network transport
shizhMSFT Mar 31, 2021
cd28c19
add makefile
shizhMSFT Mar 31, 2021
41012fb
update dependency
shizhMSFT Mar 31, 2021
62e2eee
push signature support
shizhMSFT Apr 1, 2021
20e35b6
pull signature support
shizhMSFT Apr 1, 2021
e759247
integrate sign and push
shizhMSFT Apr 1, 2021
7d70eee
no output on sign-then-push by default
shizhMSFT Apr 2, 2021
996eeb9
Merge pull request #43 from shizhMSFT/prototype-2
SteveLasker Apr 4, 2021
f7da7a7
better ux for signature info
shizhMSFT Apr 6, 2021
a1071bc
make install better
shizhMSFT Apr 8, 2021
b72e867
update notary library
shizhMSFT Apr 8, 2021
e928219
update dependencies
shizhMSFT Apr 14, 2021
1444a31
Merge pull request #50 from shizhMSFT/prototype-2
SteveLasker Apr 14, 2021
ffe6cdc
Multiple signatures support (#52)
shizhMSFT Apr 15, 2021
44d4614
pull signatures when pulling images (#54)
shizhMSFT Apr 19, 2021
5af426e
Explicit add original references when signing (#57)
shizhMSFT Apr 26, 2021
d589dd8
create parent folders before create config file (#59)
shizhMSFT Apr 28, 2021
9ad1272
Update demo script for prototype-2 (#53)
SteveLasker Apr 28, 2021
9c9f68b
Ci 2 (#49)
marcofranssen May 8, 2021
2f199a5
upgrade to prototype-3
shizhMSFT Jun 28, 2021
bee5c84
Merge prototype-3
shizhMSFT Sep 3, 2021
e304503
Notation CLI Alpha
shizhMSFT Aug 30, 2021
cdd6aaf
bump notation-go-lib
shizhMSFT Sep 6, 2021
62b35ef
prepare for 0.5.1 release
shizhMSFT Sep 6, 2021
db7b4d8
refine notation sign
dependabot[bot] Sep 6, 2021
b7ad88f
Bump actions/cache from 2.1.4 to 2.1.6
dependabot[bot] Sep 6, 2021
0d29519
extract `list` from `pull --peek`
shizhMSFT Sep 6, 2021
6502bbd
rename digest to sigDigests for code readability
shizhMSFT Sep 6, 2021
3baeee3
update doc for building
shizhMSFT Sep 6, 2021
107767c
refine doc for building
shizhMSFT Sep 6, 2021
07dada7
plain http in config
shizhMSFT Sep 6, 2021
9c5c749
no default trust on generated cert
shizhMSFT Sep 6, 2021
35ea923
clean up media type
shizhMSFT Sep 7, 2021
913848d
refine docker-notation
shizhMSFT Sep 7, 2021
601f235
cached pull
shizhMSFT Sep 7, 2021
94b55d5
refactor notation code
shizhMSFT Sep 7, 2021
7ac7bfb
fix reference print
shizhMSFT Sep 7, 2021
bd80447
refactor docker-notation code
shizhMSFT Sep 7, 2021
2862bb4
compare registry host case insensitively
shizhMSFT Sep 7, 2021
4c4a3c3
refine docker-notation pull output
shizhMSFT Sep 7, 2021
8746d03
safer prune
shizhMSFT Sep 7, 2021
379b37a
prepare for v0.5.2 release
shizhMSFT Sep 7, 2021
46918e8
update notation-go-lib dependency
shizhMSFT Sep 10, 2021
68b632e
update release for go releaser
shizhMSFT Sep 14, 2021
b3b65a5
update notation-go-lib dependency
shizhMSFT Sep 15, 2021
73d6fe0
update authors
shizhMSFT Sep 15, 2021
b75d34f
make github workflow consistent
shizhMSFT Sep 15, 2021
33d34e6
output stderr for docker-generate
shizhMSFT Sep 15, 2021
875fadd
move implementations to the correct package
shizhMSFT Sep 15, 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
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
tab_width = 2

[*.go]
indent_size = 4
tab_width = 4
indent_style = tab
# required for multiline strings in test cases
trim_trailing_whitespace = false

[Makefile]
indent_size = 4
tab_width = 4
indent_style = tab
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Ask a question
url: https://github.com/notaryproject/nv2/discussions
url: https://github.com/notaryproject/notation/discussions
about: Ask questions and discuss with other community members
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: build

on:
push:
pull_request:

jobs:
build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
name: Continuous Integration
runs-on: ubuntu-20.04
strategy:
matrix:
go-version: [1.17]
fail-fast: true
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code
uses: actions/checkout@v2
- name: Cache Go modules
uses: actions/cache@v2
id: go-mod-cache
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get dependencies
run: make download
- name: Build
run: make build
30 changes: 30 additions & 0 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: release-github

on:
push:
tags:
- v*

jobs:
build:
name: Release Notation Binaries
runs-on: ubuntu-20.04
strategy:
matrix:
go-version: [1.17]
fail-fast: true
steps:
- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout
uses: actions/checkout@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_USER_TOKEN }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# VS Code
.vscode

# Custom
bin/
vendor/
61 changes: 61 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
builds:
- main: ./cmd/notation
id: notation
binary: notation
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
ldflags:
- -s -w -X {{.ModulePath}}/internal/version.Version={{.Version}} -X {{.ModulePath}}/internal/version.BuildMetadata=
- main: ./cmd/docker-notation
id: docker-notation
binary: docker-notation
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
ldflags:
- -s -w -X {{.ModulePath}}/internal/version.Version={{.Version}} -X {{.ModulePath}}/internal/version.BuildMetadata=
- main: ./cmd/docker-generate
id: docker-generate
binary: docker-generate
env:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64
- arm64
ignore:
- goos: windows
goarch: arm64
ldflags:
- -s -w
archives:
- format: tar.gz
format_overrides:
- goos: windows
format: zip
files:
- LICENSE
release:
prerelease: auto
63 changes: 63 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
MODULE = github.com/notaryproject/notation
DOCKER_PLUGINS = docker-generate docker-notation
COMMANDS = notation $(DOCKER_PLUGINS)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
BUILD_METADATA =
ifeq ($(GIT_TAG),) # unreleased build
GIT_COMMIT = $(shell git rev-parse HEAD)
GIT_STATUS = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "unreleased")
BUILD_METADATA = $(GIT_COMMIT).$(GIT_STATUS)
endif
LDFLAGS = -X $(MODULE)/internal/version.BuildMetadata=$(BUILD_METADATA)
GO_BUILD_FLAGS = --ldflags="$(LDFLAGS)"

.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'

.PHONY: all
all: build

.PHONY: FORCE
FORCE:

bin/%: cmd/% FORCE
go build $(GO_BUILD_FLAGS) -o $@ ./$<

.PHONY: download
download: ## download dependencies via go mod
go mod download

.PHONY: build
build: $(addprefix bin/,$(COMMANDS)) ## builds binaries

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

.PHONY: check-line-endings
check-line-endings: ## check line endings
! find cmd pkg internal -name "*.go" -type f -exec file "{}" ";" | grep CRLF

.PHONY: fix-line-endings
fix-line-endings: ## fix line endings
find cmd pkg internal -type f -name "*.go" -exec sed -i -e "s/\r//g" {} +

.PHONY: vendor
vendor: ## vendores the go modules
GO111MODULE=on go mod vendor

.PHONY: install
install: install-notation install-docker-plugins ## install the notation cli and docker plugins

.PHONY: install-notation
install-notation: bin/notation ## installs the notation cli
cp $< ~/bin/

.PHONY: install-docker-%
install-docker-%: bin/docker-%
cp $< ~/.docker/cli-plugins/

.PHONY: install-docker-plugins
install-docker-plugins: $(addprefix install-,$(DOCKER_PLUGINS)) ## installs the docker plugins
cp $(addprefix bin/,$(DOCKER_PLUGINS)) ~/.docker/cli-plugins/
33 changes: 33 additions & 0 deletions building.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Building Notation

The notation repo contains the following:

- `notation` - A CLI for signing and verifying artifacts with Notation
- `docker-generate` - Extends docker with `docker generate` to create locally persisted manifest for signing, without having to push to a registry.
- `docker-notation` - Extends docker with `docker notation` to enable, sign and verify Notation signatures.

Building above binaries require [golang](https://golang.org/dl/) with version `>= 1.17`.

## Windows with WSL

- Build the binaries, installing them to:
- `~/bin/notation`
- `~/.docker/cli-plugins/docker-generate`
- `~/.docker/cli-plugins/docker-notation`
```sh
git clone https://github.com/notaryproject/notation.git
cd notation
make install
```
- Verify binaries are installed
```sh
docker --help
# look for
Management Commands:
generate* Generate artifacts (CNCF Notary Project, 0.1.0)
notation* Manage signatures on Docker images (CNCF Notary Project, 0.5.3-alpha)

which notation
# output
/home/<user>/bin/notation
```
12 changes: 12 additions & 0 deletions cmd/docker-generate/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package main

import (
"github.com/urfave/cli/v2"
)

var generateCommand = &cli.Command{
Name: "generate",
Subcommands: []*cli.Command{
manifestCommand,
},
}
21 changes: 21 additions & 0 deletions cmd/docker-generate/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package main

import (
"log"
"os"

"github.com/urfave/cli/v2"
)

func main() {
app := &cli.App{
Name: "docker",
Commands: []*cli.Command{
generateCommand,
metadataCommand,
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
66 changes: 66 additions & 0 deletions cmd/docker-generate/manifest.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package main

import (
"io"
"os"
"os/exec"

"github.com/notaryproject/notation/pkg/docker"
"github.com/urfave/cli/v2"
)

var manifestCommand = &cli.Command{
Name: "manifest",
Usage: "generates the manifest of a docker image",
ArgsUsage: "[<reference>]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "output",
Aliases: []string{"o"},
Usage: "write to a file instead of stdout",
},
},
Action: generateManifest,
}

func generateManifest(ctx *cli.Context) error {
var reader io.Reader
if reference := ctx.Args().First(); reference != "" {
cmd := exec.Command("docker", "save", reference)
cmd.Stderr = os.Stderr
stdout, err := cmd.StdoutPipe()
if err != nil {
return err
}
reader = stdout
if err := cmd.Start(); err != nil {
return err
}
} else {
reader = os.Stdin
}

var writer io.Writer
if output := ctx.String("output"); output != "" {
file, err := os.Create(output)
if err != nil {
return err
}
defer file.Close()
writer = file
} else {
writer = os.Stdout
}

manifest, err := docker.GenerateSchema2FromDockerSave(reader)
if err != nil {
return err
}
_, payload, err := manifest.Payload()
if err != nil {
return err
}

_, err = writer.Write(payload)
return err
}
Loading