mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
fix(ci/cd): detect uncommited swagger docs (#1724)
Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
parent
6d65401499
commit
ca2904762a
15 changed files with 53 additions and 45 deletions
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,7 +1,7 @@
|
||||||
name: Bug report
|
name: Bug report
|
||||||
description: File a bug report
|
description: File a bug report
|
||||||
title: "[Bug]: "
|
title: "[Bug]: "
|
||||||
labels: bug
|
labels: ["bug"]
|
||||||
body:
|
body:
|
||||||
- type: input
|
- type: input
|
||||||
attributes:
|
attributes:
|
||||||
|
|
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
@ -1,7 +1,7 @@
|
||||||
name: Feature request
|
name: Feature request
|
||||||
description: Request a feature
|
description: Request a feature
|
||||||
title: "[Feat]: "
|
title: "[Feat]: "
|
||||||
labels: feature
|
labels: ["feature"]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
|
|
2
.github/workflows/cluster.yaml
vendored
2
.github/workflows/cluster.yaml
vendored
|
@ -35,7 +35,7 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
go install github.com/swaggo/swag/cmd/swag
|
go install github.com/swaggo/swag/cmd/swag@v1.8.12
|
||||||
go mod download
|
go mod download
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install rpm uidmap
|
sudo apt-get -y install rpm uidmap
|
||||||
|
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
|
@ -54,7 +54,7 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
go install github.com/swaggo/swag/cmd/swag@latest
|
go install github.com/swaggo/swag/cmd/swag@v1.8.12
|
||||||
go mod download
|
go mod download
|
||||||
go install github.com/wadey/gocovmerge@latest
|
go install github.com/wadey/gocovmerge@latest
|
||||||
go get -u github.com/swaggo/swag/cmd/swag
|
go get -u github.com/swaggo/swag/cmd/swag
|
||||||
|
|
2
.github/workflows/ecosystem-tools.yaml
vendored
2
.github/workflows/ecosystem-tools.yaml
vendored
|
@ -25,7 +25,7 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
cd $GITHUB_WORKSPACE
|
cd $GITHUB_WORKSPACE
|
||||||
go install github.com/swaggo/swag/cmd/swag
|
go install github.com/swaggo/swag/cmd/swag@v1.8.12
|
||||||
go mod download
|
go mod download
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config rpm uidmap
|
sudo apt-get install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config rpm uidmap
|
||||||
|
|
13
Makefile
13
Makefile
|
@ -55,7 +55,7 @@ add-extensions = $(subst $(1),$(2),$(sort $(filter-valid)))
|
||||||
BUILD_LABELS = $(call add-extensions,$(space),$(comma))
|
BUILD_LABELS = $(call add-extensions,$(space),$(comma))
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: modcheck swagger binary binary-minimal binary-debug cli bench exporter-minimal verify-config test covhtml check check-gh-actions
|
all: modcheck swaggercheck binary binary-minimal binary-debug cli bench exporter-minimal verify-config test covhtml check check-gh-actions
|
||||||
|
|
||||||
.PHONY: modtidy
|
.PHONY: modtidy
|
||||||
modtidy:
|
modtidy:
|
||||||
|
@ -70,6 +70,15 @@ modcheck: modtidy
|
||||||
exit 1;\
|
exit 1;\
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
.PHONY: swaggercheck
|
||||||
|
swaggercheck: swagger
|
||||||
|
$(eval UNCOMMITED_FILES = $(shell git status --porcelain | grep -c swagger))
|
||||||
|
@if [ $(UNCOMMITED_FILES) != 0 ]; then \
|
||||||
|
echo "Updated swagger files uncommitted, make sure all swagger files are committed:";\
|
||||||
|
git status;\
|
||||||
|
exit 1;\
|
||||||
|
fi
|
||||||
|
|
||||||
.PHONY: create-name
|
.PHONY: create-name
|
||||||
create-name:
|
create-name:
|
||||||
ifdef BUILD_LABELS
|
ifdef BUILD_LABELS
|
||||||
|
@ -95,7 +104,7 @@ binary: modcheck create-name build-metadata
|
||||||
|
|
||||||
.PHONY: binary-debug
|
.PHONY: binary-debug
|
||||||
binary-debug: $(if $(findstring ui,$(BUILD_LABELS)), ui)
|
binary-debug: $(if $(findstring ui,$(BUILD_LABELS)), ui)
|
||||||
binary-debug: modcheck swagger create-name build-metadata
|
binary-debug: modcheck swaggercheck create-name build-metadata
|
||||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(OS)-$(ARCH)-debug $(BUILDMODE_FLAGS) -tags $(BUILD_LABELS),debug,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$(extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-$(OS)-$(ARCH)-debug $(BUILDMODE_FLAGS) -tags $(BUILD_LABELS),debug,containers_image_openpgp -v -gcflags all='-N -l' -ldflags "-X zotregistry.io/zot/pkg/api/config.ReleaseTag=${RELEASE_TAG} -X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=$(extended-name) -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION}" ./cmd/zot
|
||||||
|
|
||||||
.PHONY: cli
|
.PHONY: cli
|
||||||
|
|
|
@ -452,7 +452,6 @@ func (rh *RouteHandler) CheckManifest(response http.ResponseWriter, request *htt
|
||||||
response.WriteHeader(http.StatusOK)
|
response.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: https://github.com/swaggo/swag/issues/387.
|
|
||||||
type ImageManifest struct {
|
type ImageManifest struct {
|
||||||
ispec.Manifest
|
ispec.Manifest
|
||||||
}
|
}
|
||||||
|
|
|
@ -1399,7 +1399,7 @@ const docTemplate = `{
|
||||||
"description": "Platform describes the platform which the image in the manifest runs on.\n\nThis should only be used when referring to a manifest.",
|
"description": "Platform describes the platform which the image in the manifest runs on.\n\nThis should only be used when referring to a manifest.",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform"
|
"$ref": "#/definitions/v1.Platform"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1416,7 +1416,7 @@ const docTemplate = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"github_com_opencontainers_image-spec_specs-go_v1.Platform": {
|
"v1.Platform": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"architecture": {
|
"architecture": {
|
||||||
|
|
|
@ -1390,7 +1390,7 @@
|
||||||
"description": "Platform describes the platform which the image in the manifest runs on.\n\nThis should only be used when referring to a manifest.",
|
"description": "Platform describes the platform which the image in the manifest runs on.\n\nThis should only be used when referring to a manifest.",
|
||||||
"allOf": [
|
"allOf": [
|
||||||
{
|
{
|
||||||
"$ref": "#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform"
|
"$ref": "#/definitions/v1.Platform"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -1407,7 +1407,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"github_com_opencontainers_image-spec_specs-go_v1.Platform": {
|
"v1.Platform": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"architecture": {
|
"architecture": {
|
||||||
|
|
|
@ -185,7 +185,7 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
platform:
|
platform:
|
||||||
allOf:
|
allOf:
|
||||||
- $ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform'
|
- $ref: '#/definitions/v1.Platform'
|
||||||
description: |-
|
description: |-
|
||||||
Platform describes the platform which the image in the manifest runs on.
|
Platform describes the platform which the image in the manifest runs on.
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ definitions:
|
||||||
type: string
|
type: string
|
||||||
type: array
|
type: array
|
||||||
type: object
|
type: object
|
||||||
github_com_opencontainers_image-spec_specs-go_v1.Platform:
|
v1.Platform:
|
||||||
properties:
|
properties:
|
||||||
architecture:
|
architecture:
|
||||||
description: |-
|
description: |-
|
||||||
|
|
Loading…
Reference in a new issue