Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-08-10 00:06:18 +02:00
Родитель 1b7891cd65
Коммит 498c729d92
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3248E46B6BB8C7F7
17 изменённых файлов: 263 добавлений и 26 удалений

Просмотреть файл

@ -1,18 +0,0 @@
# This file is for unifying the coding style for different editors and IDEs.
# More information at http://editorconfig.org
root = true
[*]
charset = utf-8
indent_size = 2
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.go]
indent_style = tab
[*.md]
trim_trailing_whitespace = false

4
.github/workflows/test.yml поставляемый
Просмотреть файл

@ -7,14 +7,10 @@ on:
- 'v*'
tags:
- 'v*'
paths-ignore:
- '**.md'
pull_request:
branches:
- 'main'
- 'v*'
paths-ignore:
- '**.md'
jobs:
validate:

17
LICENSE
Просмотреть файл

@ -1,7 +1,7 @@
Apache License
Version 2.0, January 2004
https://www.apache.org/licenses/
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@ -176,13 +176,24 @@
END OF TERMS AND CONDITIONS
Copyright 2013-2017 Docker, Inc.
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2017 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Doc generator specially crafted for Docker CLI plugins.
//
// Get started (buildx CLI):

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2021 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docgen
import (

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2021 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docgen
import (

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2017 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docgen
import (

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2017 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docgen
import (

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2021 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
variable "GO_VERSION" {
default = "1.16"
}
@ -7,7 +21,7 @@ group "default" {
}
group "validate" {
targets = ["lint", "vendor-validate"]
targets = ["lint", "vendor-validate", "license-validate"]
}
target "lint" {
@ -58,3 +72,21 @@ target "godev" {
target = "godev"
output = ["type=cacheonly"]
}
target "license-validate" {
args = {
GO_VERSION = GO_VERSION
}
dockerfile = "./hack/license.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}
target "license-update" {
args = {
GO_VERSION = GO_VERSION
}
dockerfile = "./hack/license.Dockerfile"
target = "update"
output = ["."]
}

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2021 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (

Просмотреть файл

@ -1,4 +1,19 @@
# syntax=docker/dockerfile:1.3
# Copyright 2021 docgen authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION
ARG GITHUB_REPOSITORY
ARG GITHUB_REF

44
hack/license.Dockerfile Normal file
Просмотреть файл

@ -0,0 +1,44 @@
# syntax=docker/dockerfile:1.3
# Copyright 2021 docgen authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION
ARG ADDLICENSE_VERSION="d43bb61fdfdafb29f4b1add4b849c5bfe4eeb497"
ARG LICENSE_ARGS="-c docgen -l apache"
ARG LICENSE_FILES=".*\(Dockerfile\|\.go\|\.hcl\|\.sh\)"
FROM golang:${GO_VERSION}-alpine AS base
WORKDIR /src
RUN apk add --no-cache cpio findutils git
ENV CGO_ENABLED=0
ARG ADDLICENSE_VERSION
RUN go install github.com/google/addlicense@${ADDLICENSE_VERSION}
FROM base AS set
ARG LICENSE_ARGS
ARG LICENSE_FILES
RUN --mount=type=bind,target=.,rw \
find . -regex "${LICENSE_FILES}" | xargs addlicense ${LICENSE_ARGS} \
&& mkdir /out \
&& find . -regex "${LICENSE_FILES}" | cpio -pdm /out
FROM scratch AS update
COPY --from=set /out /
FROM base AS validate
ARG LICENSE_ARGS
ARG LICENSE_FILES
RUN --mount=type=bind,target=. \
find . -regex "${LICENSE_FILES}" | xargs addlicense -check ${LICENSE_ARGS}

Просмотреть файл

@ -1,4 +1,19 @@
# syntax=docker/dockerfile:1.3
# Copyright 2021 docgen authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION
FROM golang:${GO_VERSION}-alpine AS base

Просмотреть файл

@ -1,4 +1,19 @@
# syntax=docker/dockerfile:1.3
# Copyright 2021 docgen authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION
FROM golang:${GO_VERSION}-alpine AS base

Просмотреть файл

@ -1,4 +1,19 @@
# syntax=docker/dockerfile:1.3
# Copyright 2021 docgen authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG GO_VERSION
FROM golang:${GO_VERSION}-alpine AS base

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2017 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docgen
import (

Просмотреть файл

@ -1,3 +1,17 @@
// Copyright 2017 docgen authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package docgen
import "testing"