Global and organization registries (#1672)

Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
This commit is contained in:
Lauris BH
2024-07-03 16:33:11 +03:00
committed by GitHub
parent e5f3e67bf2
commit 28e982fffb
65 changed files with 3260 additions and 269 deletions

View File

@@ -17,6 +17,7 @@ package main
import (
"github.com/urfave/cli/v2"
"go.woodpecker-ci.org/woodpecker/v2/cli/admin"
"go.woodpecker-ci.org/woodpecker/v2/cli/common"
"go.woodpecker-ci.org/woodpecker/v2/cli/cron"
"go.woodpecker-ci.org/woodpecker/v2/cli/deploy"
@@ -25,9 +26,10 @@ import (
"go.woodpecker-ci.org/woodpecker/v2/cli/lint"
"go.woodpecker-ci.org/woodpecker/v2/cli/log"
"go.woodpecker-ci.org/woodpecker/v2/cli/loglevel"
"go.woodpecker-ci.org/woodpecker/v2/cli/org"
"go.woodpecker-ci.org/woodpecker/v2/cli/pipeline"
"go.woodpecker-ci.org/woodpecker/v2/cli/registry"
"go.woodpecker-ci.org/woodpecker/v2/cli/repo"
"go.woodpecker-ci.org/woodpecker/v2/cli/repo/registry"
"go.woodpecker-ci.org/woodpecker/v2/cli/secret"
"go.woodpecker-ci.org/woodpecker/v2/cli/setup"
"go.woodpecker-ci.org/woodpecker/v2/cli/update"
@@ -47,14 +49,17 @@ func newApp() *cli.App {
app.After = common.After
app.Suggest = true
app.Commands = []*cli.Command{
admin.Command,
org.Command,
repo.Command,
pipeline.Command,
log.Command,
deploy.Command,
exec.Command,
info.Command,
// TODO: Remove in 3.x
registry.Command,
secret.Command,
repo.Command,
user.Command,
lint.Command,
loglevel.Command,

View File

@@ -1123,6 +1123,233 @@ const docTemplate = `{
}
}
},
"/orgs/{org_id}/registries": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Organization registries"
],
"summary": "List organization registries",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the org's id",
"name": "org_id",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "for response pagination, page offset number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 50,
"description": "for response pagination, max items per page",
"name": "perPage",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Registry"
}
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"Organization registries"
],
"summary": "Create an organization registry",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the org's id",
"name": "org_id",
"in": "path",
"required": true
},
{
"description": "the new registry",
"name": "registryData",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Registry"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Registry"
}
}
}
}
},
"/orgs/{org_id}/registries/{registry}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Organization registries"
],
"summary": "Get a organization registry by address",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the org's id",
"name": "org_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "the registry's address",
"name": "registry",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Registry"
}
}
}
},
"delete": {
"produces": [
"text/plain"
],
"tags": [
"Organization registries"
],
"summary": "Delete an organization registry by name",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the org's id",
"name": "org_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "the registry's name",
"name": "registry",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
},
"patch": {
"produces": [
"application/json"
],
"tags": [
"Organization registries"
],
"summary": "Update an organization registry by name",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the org's id",
"name": "org_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "the registry's name",
"name": "registry",
"in": "path",
"required": true
},
{
"description": "the update registry data",
"name": "registryData",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Registry"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Registry"
}
}
}
}
},
"/orgs/{org_id}/secrets": {
"get": {
"produces": [
@@ -1493,6 +1720,198 @@ const docTemplate = `{
}
}
},
"/registries": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Registries"
],
"summary": "List global registries",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "for response pagination, page offset number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 50,
"description": "for response pagination, max items per page",
"name": "perPage",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Registry"
}
}
}
}
},
"post": {
"produces": [
"application/json"
],
"tags": [
"Registries"
],
"summary": "Create a global registry",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "the registry object data",
"name": "registry",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Registry"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Registry"
}
}
}
}
},
"/registries/{registry}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Registries"
],
"summary": "Get a global registry by name",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the registry's name",
"name": "registry",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Registry"
}
}
}
},
"delete": {
"produces": [
"text/plain"
],
"tags": [
"Registries"
],
"summary": "Delete a global registry by name",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the registry's name",
"name": "registry",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
}
}
},
"patch": {
"produces": [
"application/json"
],
"tags": [
"Registries"
],
"summary": "Update a global registry by name",
"parameters": [
{
"type": "string",
"default": "Bearer \u003cpersonal access token\u003e",
"description": "Insert your personal access token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "the registry's name",
"name": "registry",
"in": "path",
"required": true
},
{
"description": "the registry's data",
"name": "registryData",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Registry"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Registry"
}
}
}
}
},
"/repos": {
"get": {
"description": "Returns a list of all repositories. Requires admin rights.",
@@ -2799,7 +3218,7 @@ const docTemplate = `{
}
}
},
"/repos/{repo_id}/registry": {
"/repos/{repo_id}/registries": {
"get": {
"produces": [
"application/json"
@@ -2895,7 +3314,7 @@ const docTemplate = `{
}
}
},
"/repos/{repo_id}/registry/{registry}": {
"/repos/{repo_id}/registries/{registry}": {
"get": {
"produces": [
"application/json"
@@ -4376,9 +4795,18 @@ const docTemplate = `{
"id": {
"type": "integer"
},
"org_id": {
"type": "integer"
},
"password": {
"type": "string"
},
"readonly": {
"type": "boolean"
},
"repo_id": {
"type": "integer"
},
"username": {
"type": "string"
}