mirror of
https://github.com/mudler/luet.git
synced 2025-09-03 08:14:46 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
23e1c307b9 |
2
.github/workflows/pages.yml
vendored
2
.github/workflows/pages.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
cd docs && make build
|
||||
mv public ../
|
||||
- name: Deploy 🚀
|
||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' || github.ref == 'refs/heads/docs' && github.event_name == 'push'
|
||||
uses: JamesIves/github-pages-deploy-action@releases/v3
|
||||
with:
|
||||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
|
14
README.md
14
README.md
@@ -12,7 +12,7 @@
|
||||
|
||||
Luet is a multi-platform Package Manager based off from containers - it uses Docker (and others) to build packages. It has zero dependencies and it is well suitable for "from scratch" environments. It can also version entire rootfs and enables delivery of OTA-alike updates, making it a perfect fit for the Edge computing era and IoT embedded devices.
|
||||
|
||||
It offers a simple [specfile format](https://luet.io/docs/concepts/packages/specfile/) in YAML notation to define both [packages](https://luet.io/docs/concepts/packages/) and [rootfs](https://luet.io/docs/concepts/packages/#package-layers). As it is based on containers, it can be also used to build stages for Linux From Scratch installations and it can build and track updates for those systems.
|
||||
It offers a simple [specfile format](https://luet-lab.github.io/docs/docs/concepts/packages/specfile/) in YAML notation to define both [packages](https://luet-lab.github.io/docs/docs/concepts/packages/) and [rootfs](https://luet-lab.github.io/docs/docs/concepts/packages/#package-layers). As it is based on containers, it can be also used to build stages for Linux From Scratch installations and it can build and track updates for those systems.
|
||||
|
||||
It is written entirely in Golang and where used as package manager, it can run in from scratch environment, with zero dependencies.
|
||||
|
||||
@@ -25,10 +25,10 @@ It is written entirely in Golang and where used as package manager, it can run i
|
||||
- It builds from containers, but installs, uninstalls and perform upgrades on machines
|
||||
- Installer doesn't depend on anything ( 0 dep installer !), statically built
|
||||
- You can install it aside also with your current distro package manager, and start building and distributing your packages
|
||||
- [Support for packages as "layers"](https://luet.io/docs/concepts/packages/specfile/#building-strategies)
|
||||
- [It uses SAT solving techniques to solve the deptree](https://luet.io/docs/concepts/overview/constraints/) ( Inspired by [OPIUM](https://ranjitjhala.github.io/static/opium.pdf) )
|
||||
- Support for [collections](https://luet.io/docs/concepts/packages/collections/) and [templated package definitions](https://luet.io/docs/concepts/packages/templates/)
|
||||
- [Can be extended with Plugins and Extensions](https://luet.io/docs/concepts/plugins-and-extensions/)
|
||||
- [Support for packages as "layers"](https://luet-lab.github.io/docs/docs/concepts/packages/specfile/#building-strategies)
|
||||
- [It uses SAT solving techniques to solve the deptree](https://luet-lab.github.io/docs/docs/concepts/overview/constraints/) ( Inspired by [OPIUM](https://ranjitjhala.github.io/static/opium.pdf) )
|
||||
- Support for [collections](https://luet-lab.github.io/docs/docs/concepts/packages/collections/) and [templated package definitions](https://luet-lab.github.io/docs/docs/concepts/packages/templates/)
|
||||
- [Can be extended with Plugins and Extensions](https://luet-lab.github.io/docs/docs/concepts/plugins-and-extensions/)
|
||||
- [Can build packages in Kubernetes (experimental)](https://github.com/mudler/luet-k8s)
|
||||
- Uses containerd/go-containerregistry to manipulate images - works also daemonless with the img backend
|
||||
|
||||
@@ -37,7 +37,7 @@ It is written entirely in Golang and where used as package manager, it can run i
|
||||
To install luet, you can grab a release on the [Release page](https://github.com/mudler/luet/releases) or to install it in your system:
|
||||
|
||||
```bash
|
||||
$ curl https://luet.io/install.sh | sudo sh
|
||||
$ curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
|
||||
$ luet search ...
|
||||
$ luet install ..
|
||||
$ luet --help
|
||||
@@ -53,7 +53,7 @@ $ make build
|
||||
|
||||
## Documentation
|
||||
|
||||
[Documentation](https://luet.io/) is available, or
|
||||
[Documentation](https://luet-lab.github.io/docs) is available, or
|
||||
run `luet --help`, any subcommand is documented as well, try e.g.: `luet build --help`.
|
||||
|
||||
# Dependency solving
|
||||
|
@@ -31,8 +31,6 @@ func init() {
|
||||
RootCmd.AddCommand(repoGroupCmd)
|
||||
|
||||
repoGroupCmd.AddCommand(
|
||||
NewRepoAddCommand(),
|
||||
NewRepoGetCommand(),
|
||||
NewRepoListCommand(),
|
||||
NewRepoUpdateCommand(),
|
||||
)
|
||||
|
137
cmd/repo/add.go
137
cmd/repo/add.go
@@ -1,137 +0,0 @@
|
||||
// Copyright © 2022 Ettore Di Giacinto <mudler@luet.io>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd_repo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/mudler/luet/cmd/util"
|
||||
"github.com/mudler/luet/pkg/api/core/types"
|
||||
"github.com/mudler/luet/pkg/helpers"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewRepoAddCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "add [OPTIONS] https://..../something.yaml /local/file.yaml",
|
||||
Short: "Add a repository to the system",
|
||||
Args: cobra.ExactArgs(1),
|
||||
Long: `
|
||||
Adds a repository to the system. URLs, local files or inline repo can be specified, examples:
|
||||
|
||||
# URL/File:
|
||||
|
||||
luet repo add /path/to/file
|
||||
|
||||
luet repo add https://....
|
||||
|
||||
luet repo add ... --name "foo"
|
||||
|
||||
# Inline:
|
||||
|
||||
luet repo add testfo --description "Bar" --url "FOZZ" --type "ff"
|
||||
|
||||
`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
|
||||
uri := args[0]
|
||||
d, _ := cmd.Flags().GetString("dir")
|
||||
yes, _ := cmd.Flags().GetBool("yes")
|
||||
|
||||
desc, _ := cmd.Flags().GetString("description")
|
||||
t, _ := cmd.Flags().GetString("type")
|
||||
url, _ := cmd.Flags().GetString("url")
|
||||
ref, _ := cmd.Flags().GetString("reference")
|
||||
prio, _ := cmd.Flags().GetInt("priority")
|
||||
|
||||
if len(util.DefaultContext.Config.RepositoriesConfDir) == 0 && d == "" {
|
||||
util.DefaultContext.Fatal("No repository dirs defined")
|
||||
return
|
||||
}
|
||||
if d == "" {
|
||||
d = util.DefaultContext.Config.RepositoriesConfDir[0]
|
||||
}
|
||||
|
||||
var r *types.LuetRepository
|
||||
str, err := helpers.GetURI(uri)
|
||||
if err != nil {
|
||||
r = &types.LuetRepository{
|
||||
Enable: true,
|
||||
Cached: true,
|
||||
Name: uri,
|
||||
Description: desc,
|
||||
ReferenceID: ref,
|
||||
Type: t,
|
||||
Urls: []string{url},
|
||||
Priority: prio,
|
||||
}
|
||||
} else {
|
||||
r, err = types.LoadRepository([]byte(str))
|
||||
if err != nil {
|
||||
util.DefaultContext.Fatal(err)
|
||||
}
|
||||
if desc != "" {
|
||||
r.Description = desc
|
||||
}
|
||||
if ref != "" {
|
||||
r.ReferenceID = ref
|
||||
}
|
||||
if t != "" {
|
||||
r.Type = t
|
||||
}
|
||||
if url != "" {
|
||||
r.Urls = []string{url}
|
||||
}
|
||||
if prio != 0 {
|
||||
r.Priority = prio
|
||||
}
|
||||
}
|
||||
|
||||
file := filepath.Join(util.DefaultContext.Config.System.Rootfs, d, fmt.Sprintf("%s.yaml", r.Name))
|
||||
|
||||
b, err := yaml.Marshal(r)
|
||||
if err != nil {
|
||||
util.DefaultContext.Fatal(err)
|
||||
}
|
||||
|
||||
util.DefaultContext.Infof("Adding repository to the sytem as %s", file)
|
||||
fmt.Println(string(b))
|
||||
util.DefaultContext.Info(r.String())
|
||||
|
||||
if !yes && !util.DefaultContext.Ask() {
|
||||
util.DefaultContext.Info("Aborted by user")
|
||||
return
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(file, b, os.ModePerm); err != nil {
|
||||
util.DefaultContext.Fatal(err)
|
||||
}
|
||||
},
|
||||
}
|
||||
cmd.Flags().BoolP("yes", "y", false, "Assume yes to questions")
|
||||
cmd.Flags().StringP("dir", "o", "", "Folder to write to")
|
||||
cmd.Flags().String("description", "", "Repository description")
|
||||
cmd.Flags().String("type", "", "Repository type")
|
||||
cmd.Flags().String("url", "", "Repository URL")
|
||||
cmd.Flags().String("reference", "", "Repository Reference ID")
|
||||
cmd.Flags().IntP("priority", "p", 99, "repository prio")
|
||||
return cmd
|
||||
}
|
@@ -1,62 +0,0 @@
|
||||
// Copyright © 2022 Ettore Di Giacinto <mudler@luet.io>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package cmd_repo
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/ghodss/yaml"
|
||||
"github.com/mudler/luet/cmd/util"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewRepoGetCommand() *cobra.Command {
|
||||
var ans = &cobra.Command{
|
||||
Use: "get [OPTIONS] name",
|
||||
Short: "get repository in the system",
|
||||
Args: cobra.ExactArgs(1),
|
||||
PreRun: func(cmd *cobra.Command, args []string) {
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
o, _ := cmd.Flags().GetString("output")
|
||||
|
||||
for _, repo := range util.DefaultContext.Config.SystemRepositories {
|
||||
if repo.Name != args[0] {
|
||||
continue
|
||||
}
|
||||
|
||||
switch strings.ToLower(o) {
|
||||
case "json":
|
||||
b, _ := json.Marshal(repo)
|
||||
fmt.Println(string(b))
|
||||
case "yaml":
|
||||
b, _ := yaml.Marshal(repo)
|
||||
fmt.Println(string(b))
|
||||
default:
|
||||
fmt.Println(repo)
|
||||
}
|
||||
break
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
ans.Flags().StringP("output", "o", "", "output format (json, yaml, text)")
|
||||
|
||||
return ans
|
||||
}
|
@@ -30,7 +30,7 @@ var cfgFile string
|
||||
var Verbose bool
|
||||
|
||||
const (
|
||||
LuetCLIVersion = "0.30.0"
|
||||
LuetCLIVersion = "0.22.6"
|
||||
LuetEnvPrefix = "LUET"
|
||||
)
|
||||
|
||||
|
@@ -9,36 +9,6 @@ description: >
|
||||
|
||||
After a set of packages has been built, a repository must be created in order to make them accessible by Luet clients. A Repository can be served either local files or via http(s) (at the moment of writing). Luet, by default, supports multiple-repositories with priorities.
|
||||
|
||||
|
||||
## Repository fields
|
||||
|
||||
```yaml
|
||||
name: "..."
|
||||
description: "..."
|
||||
type: "docker"
|
||||
cached: true
|
||||
enabled: true
|
||||
arch: "amd64"
|
||||
priority: 3
|
||||
urls:
|
||||
- "..."
|
||||
```
|
||||
|
||||
Repositories have the following fields, notably:
|
||||
|
||||
- `name`: Repository name
|
||||
- `description`: Repository description
|
||||
- `cached`: Enable/disable repository cache
|
||||
- `enable`: Enable/disables the repository
|
||||
- `urls`: A List of urls where the repository is hosted from
|
||||
- `type`: Repository type ( `docker`, `disk`, `http` are currently supported )
|
||||
- `arch`: (optional) Denotes the arch repository. If present, it will enable the repository automatically if the corresponding arch is matching with the host running `luet`. `enable: true` would override this behavior
|
||||
- `reference`: (optional) A reference to a repository index file to use to retrieve the repository metadata instead of latest. This can be used to point to a different or an older repository index to act as a "wayback machine". The client will consume the repository state from that snapshot instead of latest.
|
||||
|
||||
{{% alert title="Note" %}}
|
||||
The `reference` field has to be a valid tag. For example, if a repository is a docker type, browse the image tags. The repository index snapshots are prefixed with a timestamp, and ending in `repository.yaml`. For example ` 20211027153653-repository.yaml`
|
||||
{{% /alert %}}
|
||||
|
||||
## Create a repository
|
||||
|
||||
After issuing a `luet build`, the built packages are present in the output build directory. The `create-repo` step is needed to generate a portable tree, which is read by the clients, and a `repository.yaml` which contains the repository metadata.
|
||||
@@ -119,28 +89,6 @@ When specifying the `docker` repository type, `luet` will generate final images
|
||||
|
||||
The login to the container registry is not handled, the daemon needs to have already proper permissions to push the image to the destination.
|
||||
|
||||
## Repositories snapshots
|
||||
|
||||
Luet automatically will create repository index snapshots. This allows clients to point to specific references of repositories besides the latest package set published.
|
||||
|
||||
`luet create-repo` optionally takes a `--snapshot-id` argument to define the snapshot name, otherwise it defaults to the unix date timestamp.
|
||||
|
||||
Combined with `--push-images` with a container repository type, it automatically tags and pushes snapshots images too.
|
||||
|
||||
### Consuming repository snapshots
|
||||
|
||||
A client can define a repository, with an optional `reference` keyword:
|
||||
|
||||
```yaml
|
||||
name: "..."
|
||||
description: "..."
|
||||
type: "docker"
|
||||
priority: 3
|
||||
reference: 20220204175357-repository.yaml
|
||||
urls:
|
||||
- "..."
|
||||
```
|
||||
|
||||
|
||||
## Notes
|
||||
|
||||
|
@@ -9,7 +9,7 @@ description: >
|
||||
|
||||
## Prerequisites
|
||||
|
||||
No dependencies. For building packages [see the Build Packages section](/docs/concepts/overview/build_packages/)
|
||||
No dependencies. For building packages [see the Build Packages section](/docs/docs/concepts/overview/build_packages/)
|
||||
|
||||
## Get Luet
|
||||
|
||||
@@ -20,7 +20,7 @@ Just grab a release from [the release page on GitHub](https://github.com/mudler/
|
||||
Or you can install Luet also with a single command:
|
||||
|
||||
```bash
|
||||
curl https://luet.io/install.sh | sudo sh
|
||||
curl https://get.mocaccino.org/luet/get_luet_root.sh | sudo sh
|
||||
```
|
||||
|
||||
### Building Luet from source
|
||||
|
@@ -18,5 +18,4 @@ Here is a list of references to projects that are related to Luet (open up a PR
|
||||
| Example repository template to build packages on github actions and push packages on a container registry | https://github.com/Luet-lab/github-repository |
|
||||
| Immutable container OS toolkit | https://github.com/rancher-sandbox/cOS-toolkit |
|
||||
| mocaccinoOS desktop | https://github.com/mocaccinoOS/desktop |
|
||||
| mocaccinoOS extra | https://github.com/mocaccinoOS/mocaccino-extra |
|
||||
| agregOS built with luet/mocaccino | https://interne.agreg.org/agregOS/ |
|
||||
| mocaccinoOS extra | https://github.com/mocaccinoOS/mocaccino-extra |
|
4
go.mod
4
go.mod
@@ -10,10 +10,10 @@ require (
|
||||
github.com/Sabayon/pkgs-checker v0.8.4
|
||||
github.com/asdine/storm v0.0.0-20190418133842-e0f77eada154
|
||||
github.com/cavaliercoder/grab v1.0.1-0.20201108051000-98a5bfe305ec
|
||||
github.com/containerd/containerd v1.5.10
|
||||
github.com/containerd/containerd v1.5.9
|
||||
github.com/crillab/gophersat v1.3.2-0.20210701121804-72b19f5b6b38
|
||||
github.com/docker/cli v20.10.10+incompatible
|
||||
github.com/docker/distribution v2.8.0+incompatible
|
||||
github.com/docker/distribution v2.7.1+incompatible
|
||||
github.com/docker/docker v20.10.10+incompatible
|
||||
github.com/docker/go-units v0.4.0
|
||||
github.com/ecooper/qlearning v0.0.0-20160612200101-3075011a69fd
|
||||
|
7
go.sum
7
go.sum
@@ -214,8 +214,8 @@ github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09Zvgq
|
||||
github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s=
|
||||
github.com/containerd/containerd v1.5.1/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g=
|
||||
github.com/containerd/containerd v1.5.7/go.mod h1:gyvv6+ugqY25TiXxcZC3L5yOeYgEw0QMhscqVp1AR9c=
|
||||
github.com/containerd/containerd v1.5.10 h1:3cQ2uRVCkJVcx5VombsE7105Gl9Wrl7ORAO3+4+ogf4=
|
||||
github.com/containerd/containerd v1.5.10/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ=
|
||||
github.com/containerd/containerd v1.5.9 h1:rs6Xg1gtIxaeyG+Smsb/0xaSDu1VgFhOCKBXxMxbsF4=
|
||||
github.com/containerd/containerd v1.5.9/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ=
|
||||
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y=
|
||||
@@ -311,9 +311,8 @@ github.com/docker/cli v20.10.10+incompatible h1:kcbwdgWbrBOH8QwQzaJmyriHwF7XIl4H
|
||||
github.com/docker/cli v20.10.10+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
|
||||
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
|
||||
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
|
||||
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/distribution v2.8.0+incompatible h1:l9EaZDICImO1ngI+uTifW+ZYvvz7fKISBAKpg+MbWbY=
|
||||
github.com/docker/distribution v2.8.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
|
||||
github.com/docker/docker v20.10.10+incompatible h1:GKkP0T7U4ks6X3lmmHKC2QDprnpRJor2Z5a8m62R9ZM=
|
||||
github.com/docker/docker v20.10.10+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
|
||||
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
|
||||
|
@@ -1,62 +0,0 @@
|
||||
// Copyright © 2022 Ettore Di Giacinto <mudler@gentoo.org>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along
|
||||
// with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func IsUrl(s string) bool {
|
||||
url, err := url.Parse(s)
|
||||
if err != nil || url.Scheme == "" {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func GetURI(s string) (string, error) {
|
||||
f, err := os.Stat(s)
|
||||
|
||||
switch {
|
||||
case err == nil && f.IsDir():
|
||||
return "", errors.New("directories not supported")
|
||||
case err == nil:
|
||||
b, err := ioutil.ReadFile(s)
|
||||
return string(b), err
|
||||
case IsUrl(s):
|
||||
resp, err := http.Get(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
buf := bytes.NewBuffer([]byte{})
|
||||
_, err = io.Copy(buf, resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return buf.String(), nil
|
||||
default:
|
||||
return "", errors.New("not supported")
|
||||
}
|
||||
}
|
20
vendor/github.com/docker/distribution/.golangci.yml
generated
vendored
20
vendor/github.com/docker/distribution/.golangci.yml
generated
vendored
@@ -1,20 +0,0 @@
|
||||
linters:
|
||||
enable:
|
||||
- structcheck
|
||||
- varcheck
|
||||
- staticcheck
|
||||
- unconvert
|
||||
- gofmt
|
||||
- goimports
|
||||
- golint
|
||||
- ineffassign
|
||||
- vet
|
||||
- unused
|
||||
- misspell
|
||||
disable:
|
||||
- errcheck
|
||||
|
||||
run:
|
||||
deadline: 2m
|
||||
skip-dirs:
|
||||
- vendor
|
16
vendor/github.com/docker/distribution/.gometalinter.json
generated
vendored
Normal file
16
vendor/github.com/docker/distribution/.gometalinter.json
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"Vendor": true,
|
||||
"Deadline": "2m",
|
||||
"Sort": ["linter", "severity", "path", "line"],
|
||||
"EnableGC": true,
|
||||
"Enable": [
|
||||
"structcheck",
|
||||
"staticcheck",
|
||||
"unconvert",
|
||||
|
||||
"gofmt",
|
||||
"goimports",
|
||||
"golint",
|
||||
"vet"
|
||||
]
|
||||
}
|
14
vendor/github.com/docker/distribution/.mailmap
generated
vendored
14
vendor/github.com/docker/distribution/.mailmap
generated
vendored
@@ -30,17 +30,3 @@ Helen Xie <xieyulin821@harmonycloud.cn> Helen-xie <xieyulin821@harmonycloud.cn>
|
||||
Mike Brown <brownwm@us.ibm.com> Mike Brown <mikebrow@users.noreply.github.com>
|
||||
Manish Tomar <manish.tomar@docker.com> Manish Tomar <manishtomar@users.noreply.github.com>
|
||||
Sakeven Jiang <jc5930@sina.cn> sakeven <jc5930@sina.cn>
|
||||
Milos Gajdos <milosgajdos83@gmail.com> Milos Gajdos <milosgajdos@users.noreply.github.com>
|
||||
Derek McGowan <derek@mcgstyle.net> Derek McGowa <dmcgowan@users.noreply.github.com>
|
||||
Adrian Plata <adrian.plata@docker.com> Adrian Plata <@users.noreply.github.com>
|
||||
Sebastiaan van Stijn <github@gone.nl> Sebastiaan van Stijn <thaJeztah@users.noreply.github.com>
|
||||
Vishesh Jindal <vishesh92@gmail.com> Vishesh Jindal <vishesh92@users.noreply.github.com>
|
||||
Wang Yan <wangyan@vmware.com> Wang Yan <wy65701436@users.noreply.github.com>
|
||||
Chris Patterson <chrispat@github.com> Chris Patterson <chrispat@users.noreply.github.com>
|
||||
Eohyung Lee <liquidnuker@gmail.com> Eohyung Lee <leoh0@users.noreply.github.com>
|
||||
João Pereira <484633+joaodrp@users.noreply.github.com>
|
||||
Smasherr <soundcracker@gmail.com> Smasherr <Smasherr@users.noreply.github.com>
|
||||
Thomas Berger <loki@lokis-chaos.de> Thomas Berger <tbe@users.noreply.github.com>
|
||||
Samuel Karp <skarp@amazon.com> Samuel Karp <samuelkarp@users.noreply.github.com>
|
||||
Justin Cormack <justin.cormack@docker.com>
|
||||
sayboras <sayboras@yahoo.com>
|
||||
|
51
vendor/github.com/docker/distribution/.travis.yml
generated
vendored
Normal file
51
vendor/github.com/docker/distribution/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
dist: trusty
|
||||
sudo: required
|
||||
# setup travis so that we can run containers for integration tests
|
||||
services:
|
||||
- docker
|
||||
|
||||
language: go
|
||||
|
||||
go:
|
||||
- "1.11.x"
|
||||
|
||||
go_import_path: github.com/docker/distribution
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- python-minimal
|
||||
|
||||
|
||||
env:
|
||||
- TRAVIS_GOOS=linux DOCKER_BUILDTAGS="include_oss include_gcs" TRAVIS_CGO_ENABLED=1
|
||||
|
||||
before_install:
|
||||
- uname -r
|
||||
- sudo apt-get -q update
|
||||
|
||||
install:
|
||||
- go get -u github.com/vbatts/git-validation
|
||||
# TODO: Add enforcement of license
|
||||
# - go get -u github.com/kunalkushwaha/ltag
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
|
||||
script:
|
||||
- export GOOS=$TRAVIS_GOOS
|
||||
- export CGO_ENABLED=$TRAVIS_CGO_ENABLED
|
||||
- DCO_VERBOSITY=-q script/validate/dco
|
||||
- GOOS=linux script/setup/install-dev-tools
|
||||
- script/validate/vendor
|
||||
- go build -i .
|
||||
- make check
|
||||
- make build
|
||||
- make binaries
|
||||
# Currently takes too long
|
||||
#- if [ "$GOOS" = "linux" ]; then make test-race ; fi
|
||||
- if [ "$GOOS" = "linux" ]; then make coverage ; fi
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash) -F linux
|
||||
|
||||
before_deploy:
|
||||
# Run tests with storage driver configurations
|
49
vendor/github.com/docker/distribution/Dockerfile
generated
vendored
49
vendor/github.com/docker/distribution/Dockerfile
generated
vendored
@@ -1,45 +1,22 @@
|
||||
# syntax=docker/dockerfile:1.3
|
||||
FROM golang:1.11-alpine AS build
|
||||
|
||||
ARG GO_VERSION=1.16
|
||||
ARG GORELEASER_XX_VERSION=1.2.5
|
||||
ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution
|
||||
ENV BUILDTAGS include_oss include_gcs
|
||||
|
||||
FROM --platform=$BUILDPLATFORM crazymax/goreleaser-xx:${GORELEASER_XX_VERSION} AS goreleaser-xx
|
||||
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
|
||||
COPY --from=goreleaser-xx / /
|
||||
RUN apk add --no-cache file git
|
||||
WORKDIR /go/src/github.com/docker/distribution
|
||||
ARG GOOS=linux
|
||||
ARG GOARCH=amd64
|
||||
ARG GOARM=6
|
||||
|
||||
FROM base AS build
|
||||
ENV GO111MODULE=auto
|
||||
ENV CGO_ENABLED=0
|
||||
ARG TARGETPLATFORM
|
||||
ARG PKG="github.com/distribution/distribution"
|
||||
ARG BUILDTAGS="include_oss include_gcs"
|
||||
RUN --mount=type=bind,rw \
|
||||
--mount=type=cache,target=/root/.cache/go-build \
|
||||
--mount=target=/go/pkg/mod,type=cache \
|
||||
goreleaser-xx --debug \
|
||||
--name="registry" \
|
||||
--dist="/out" \
|
||||
--main="./cmd/registry" \
|
||||
--flags="-v" \
|
||||
--ldflags="-s -w -X '$PKG/version.Version={{.Version}}' -X '$PKG/version.Revision={{.Commit}}' -X '$PKG/version.Package=$PKG'" \
|
||||
--tags="$BUILDTAGS" \
|
||||
--files="LICENSE" \
|
||||
--files="README.md"
|
||||
RUN set -ex \
|
||||
&& apk add --no-cache make git file
|
||||
|
||||
FROM scratch AS artifacts
|
||||
COPY --from=build /out/*.tar.gz /
|
||||
COPY --from=build /out/*.zip /
|
||||
COPY --from=build /out/*.sha256 /
|
||||
WORKDIR $DISTRIBUTION_DIR
|
||||
COPY . $DISTRIBUTION_DIR
|
||||
RUN CGO_ENABLED=0 make PREFIX=/go clean binaries && file ./bin/registry | grep "statically linked"
|
||||
|
||||
FROM scratch AS binary
|
||||
COPY --from=build /usr/local/bin/registry* /
|
||||
|
||||
FROM alpine:3.14
|
||||
RUN apk add --no-cache ca-certificates
|
||||
FROM alpine
|
||||
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
|
||||
COPY --from=build /usr/local/bin/registry /bin/registry
|
||||
COPY --from=build /go/src/github.com/docker/distribution/bin/registry /bin/registry
|
||||
VOLUME ["/var/lib/registry"]
|
||||
EXPOSE 5000
|
||||
ENTRYPOINT ["registry"]
|
||||
|
2
vendor/github.com/docker/distribution/Makefile
generated
vendored
2
vendor/github.com/docker/distribution/Makefile
generated
vendored
@@ -50,7 +50,7 @@ version/version.go:
|
||||
|
||||
check: ## run all linters (TODO: enable "unused", "varcheck", "ineffassign", "unconvert", "staticheck", "goimports", "structcheck")
|
||||
@echo "$(WHALE) $@"
|
||||
golangci-lint run
|
||||
gometalinter --config .gometalinter.json ./...
|
||||
|
||||
test: ## run tests, except integration test with test.short
|
||||
@echo "$(WHALE) $@"
|
||||
|
2
vendor/github.com/docker/distribution/blobs.go
generated
vendored
2
vendor/github.com/docker/distribution/blobs.go
generated
vendored
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
"github.com/opencontainers/go-digest"
|
||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/opencontainers/image-spec/specs-go/v1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
51
vendor/github.com/docker/distribution/docker-bake.hcl
generated
vendored
51
vendor/github.com/docker/distribution/docker-bake.hcl
generated
vendored
@@ -1,51 +0,0 @@
|
||||
group "default" {
|
||||
targets = ["image-local"]
|
||||
}
|
||||
|
||||
// Special target: https://github.com/docker/metadata-action#bake-definition
|
||||
target "docker-metadata-action" {
|
||||
tags = ["registry:local"]
|
||||
}
|
||||
|
||||
target "binary" {
|
||||
target = "binary"
|
||||
output = ["./bin"]
|
||||
}
|
||||
|
||||
target "artifact" {
|
||||
target = "artifacts"
|
||||
output = ["./bin"]
|
||||
}
|
||||
|
||||
target "artifact-all" {
|
||||
inherits = ["artifact"]
|
||||
platforms = [
|
||||
"linux/amd64",
|
||||
"linux/arm/v6",
|
||||
"linux/arm/v7",
|
||||
"linux/arm64",
|
||||
"linux/ppc64le",
|
||||
"linux/s390x"
|
||||
]
|
||||
}
|
||||
|
||||
target "image" {
|
||||
inherits = ["docker-metadata-action"]
|
||||
}
|
||||
|
||||
target "image-local" {
|
||||
inherits = ["image"]
|
||||
output = ["type=docker"]
|
||||
}
|
||||
|
||||
target "image-all" {
|
||||
inherits = ["image"]
|
||||
platforms = [
|
||||
"linux/amd64",
|
||||
"linux/arm/v6",
|
||||
"linux/arm/v7",
|
||||
"linux/arm64",
|
||||
"linux/ppc64le",
|
||||
"linux/s390x"
|
||||
]
|
||||
}
|
2
vendor/github.com/docker/distribution/manifests.go
generated
vendored
2
vendor/github.com/docker/distribution/manifests.go
generated
vendored
@@ -87,7 +87,7 @@ func ManifestMediaTypes() (mediaTypes []string) {
|
||||
// UnmarshalFunc implements manifest unmarshalling a given MediaType
|
||||
type UnmarshalFunc func([]byte) (Manifest, Descriptor, error)
|
||||
|
||||
var mappings = make(map[string]UnmarshalFunc)
|
||||
var mappings = make(map[string]UnmarshalFunc, 0)
|
||||
|
||||
// UnmarshalManifest looks up manifest unmarshal functions based on
|
||||
// MediaType
|
||||
|
29
vendor/github.com/docker/distribution/reference/normalize.go
generated
vendored
29
vendor/github.com/docker/distribution/reference/normalize.go
generated
vendored
@@ -56,35 +56,6 @@ func ParseNormalizedNamed(s string) (Named, error) {
|
||||
return named, nil
|
||||
}
|
||||
|
||||
// ParseDockerRef normalizes the image reference following the docker convention. This is added
|
||||
// mainly for backward compatibility.
|
||||
// The reference returned can only be either tagged or digested. For reference contains both tag
|
||||
// and digest, the function returns digested reference, e.g. docker.io/library/busybox:latest@
|
||||
// sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa will be returned as
|
||||
// docker.io/library/busybox@sha256:7cc4b5aefd1d0cadf8d97d4350462ba51c694ebca145b08d7d41b41acc8db5aa.
|
||||
func ParseDockerRef(ref string) (Named, error) {
|
||||
named, err := ParseNormalizedNamed(ref)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, ok := named.(NamedTagged); ok {
|
||||
if canonical, ok := named.(Canonical); ok {
|
||||
// The reference is both tagged and digested, only
|
||||
// return digested.
|
||||
newNamed, err := WithName(canonical.Name())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
newCanonical, err := WithDigest(newNamed, canonical.Digest())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return newCanonical, nil
|
||||
}
|
||||
}
|
||||
return TagNameOnly(named), nil
|
||||
}
|
||||
|
||||
// splitDockerDomain splits a repository name to domain and remotename string.
|
||||
// If no valid domain is found, the default domain is used. Repository name
|
||||
// needs to be already validated before.
|
||||
|
2
vendor/github.com/docker/distribution/reference/reference.go
generated
vendored
2
vendor/github.com/docker/distribution/reference/reference.go
generated
vendored
@@ -205,7 +205,7 @@ func Parse(s string) (Reference, error) {
|
||||
var repo repository
|
||||
|
||||
nameMatch := anchoredNameRegexp.FindStringSubmatch(matches[1])
|
||||
if len(nameMatch) == 3 {
|
||||
if nameMatch != nil && len(nameMatch) == 3 {
|
||||
repo.domain = nameMatch[1]
|
||||
repo.path = nameMatch[2]
|
||||
} else {
|
||||
|
6
vendor/github.com/docker/distribution/registry/api/errcode/errors.go
generated
vendored
6
vendor/github.com/docker/distribution/registry/api/errcode/errors.go
generated
vendored
@@ -207,11 +207,11 @@ func (errs Errors) MarshalJSON() ([]byte, error) {
|
||||
for _, daErr := range errs {
|
||||
var err Error
|
||||
|
||||
switch daErr := daErr.(type) {
|
||||
switch daErr.(type) {
|
||||
case ErrorCode:
|
||||
err = daErr.WithDetail(nil)
|
||||
err = daErr.(ErrorCode).WithDetail(nil)
|
||||
case Error:
|
||||
err = daErr
|
||||
err = daErr.(Error)
|
||||
default:
|
||||
err = ErrorCodeUnknown.WithDetail(daErr)
|
||||
|
||||
|
12
vendor/github.com/docker/distribution/registry/api/v2/urls.go
generated
vendored
12
vendor/github.com/docker/distribution/registry/api/v2/urls.go
generated
vendored
@@ -252,3 +252,15 @@ func appendValuesURL(u *url.URL, values ...url.Values) *url.URL {
|
||||
u.RawQuery = merged.Encode()
|
||||
return u
|
||||
}
|
||||
|
||||
// appendValues appends the parameters to the url. Panics if the string is not
|
||||
// a url.
|
||||
func appendValues(u string, values ...url.Values) string {
|
||||
up, err := url.Parse(u)
|
||||
|
||||
if err != nil {
|
||||
panic(err) // should never happen
|
||||
}
|
||||
|
||||
return appendValuesURL(up, values...).String()
|
||||
}
|
||||
|
@@ -117,8 +117,8 @@ func init() {
|
||||
var t octetType
|
||||
isCtl := c <= 31 || c == 127
|
||||
isChar := 0 <= c && c <= 127
|
||||
isSeparator := strings.ContainsRune(" \t\"(),/:;<=>?@[]\\{}", rune(c))
|
||||
if strings.ContainsRune(" \t\r\n", rune(c)) {
|
||||
isSeparator := strings.IndexRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) >= 0
|
||||
if strings.IndexRune(" \t\r\n", rune(c)) >= 0 {
|
||||
t |= isSpace
|
||||
}
|
||||
if isChar && !isCtl && !isSeparator {
|
||||
|
9
vendor/github.com/docker/distribution/registry/client/repository.go
generated
vendored
9
vendor/github.com/docker/distribution/registry/client/repository.go
generated
vendored
@@ -16,7 +16,7 @@ import (
|
||||
|
||||
"github.com/docker/distribution"
|
||||
"github.com/docker/distribution/reference"
|
||||
v2 "github.com/docker/distribution/registry/api/v2"
|
||||
"github.com/docker/distribution/registry/api/v2"
|
||||
"github.com/docker/distribution/registry/client/transport"
|
||||
"github.com/docker/distribution/registry/storage/cache"
|
||||
"github.com/docker/distribution/registry/storage/cache/memory"
|
||||
@@ -736,12 +736,7 @@ func (bs *blobs) Create(ctx context.Context, options ...distribution.BlobCreateO
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", u, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := bs.client.Do(req)
|
||||
resp, err := bs.client.Post(u, "", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
4
vendor/github.com/docker/distribution/vendor.conf
generated
vendored
4
vendor/github.com/docker/distribution/vendor.conf
generated
vendored
@@ -8,7 +8,7 @@ github.com/bugsnag/bugsnag-go b1d153021fcd90ca3f080db36bec96dc690fb274
|
||||
github.com/bugsnag/osext 0dd3f918b21bec95ace9dc86c7e70266cfc5c702
|
||||
github.com/bugsnag/panicwrap e2c28503fcd0675329da73bf48b33404db873782
|
||||
github.com/denverdino/aliyungo afedced274aa9a7fcdd47ac97018f0f8db4e5de2
|
||||
github.com/dgrijalva/jwt-go 4bbdd8ac624fc7a9ef7aec841c43d99b5fe65a29 https://github.com/golang-jwt/jwt.git # v3.2.2
|
||||
github.com/dgrijalva/jwt-go a601269ab70c205d26370c16f7c81e9017c14e04
|
||||
github.com/docker/go-metrics 399ea8c73916000c64c2c76e8da00ca82f8387ab
|
||||
github.com/docker/libtrust fa567046d9b14f6aa788882a950d69651d230b21
|
||||
github.com/garyburd/redigo 535138d7bcd717d6531c701ef5933d98b1866257
|
||||
@@ -48,4 +48,4 @@ gopkg.in/square/go-jose.v1 40d457b439244b546f023d056628e5184136899b
|
||||
gopkg.in/yaml.v2 v2.2.1
|
||||
rsc.io/letsencrypt e770c10b0f1a64775ae91d240407ce00d1a5bdeb https://github.com/dmcgowan/letsencrypt.git
|
||||
github.com/opencontainers/go-digest a6d0ee40d4207ea02364bd3b9e8e77b9159ba1eb
|
||||
github.com/opencontainers/image-spec 67d2d5658fe0476ab9bf414cec164077ebff3920 # v1.0.2
|
||||
github.com/opencontainers/image-spec ab7389ef9f50030c9b245bc16b981c7ddf192882
|
||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@@ -65,7 +65,7 @@ github.com/cespare/xxhash/v2
|
||||
github.com/chuckpreslar/emission
|
||||
# github.com/containerd/cgroups v1.0.1
|
||||
github.com/containerd/cgroups/stats/v1
|
||||
# github.com/containerd/containerd v1.5.10
|
||||
# github.com/containerd/containerd v1.5.9
|
||||
## explicit
|
||||
github.com/containerd/containerd/archive
|
||||
github.com/containerd/containerd/archive/compression
|
||||
@@ -96,7 +96,7 @@ github.com/docker/cli/cli/config/configfile
|
||||
github.com/docker/cli/cli/config/credentials
|
||||
github.com/docker/cli/cli/config/types
|
||||
github.com/docker/cli/cli/trust
|
||||
# github.com/docker/distribution v2.8.0+incompatible
|
||||
# github.com/docker/distribution v2.7.1+incompatible
|
||||
## explicit
|
||||
github.com/docker/distribution
|
||||
github.com/docker/distribution/digestset
|
||||
|
Reference in New Issue
Block a user