0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00

fix(ci/cd): detect uncommited swagger docs (#1724)

Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
Alexei Dodon 2023-08-23 19:21:43 +03:00 committed by GitHub
parent 6d65401499
commit ca2904762a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 53 additions and 45 deletions

View file

@ -1,7 +1,7 @@
name: Bug report
description: File a bug report
title: "[Bug]: "
labels: bug
labels: ["bug"]
body:
- type: input
attributes:

View file

@ -1,7 +1,7 @@
name: Feature request
description: Request a feature
title: "[Feat]: "
labels: feature
labels: ["feature"]
body:
- type: textarea
attributes:

View file

@ -35,7 +35,7 @@ jobs:
- name: Install dependencies
run: |
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
sudo apt-get update
sudo apt-get -y install rpm uidmap

View file

@ -54,7 +54,7 @@ jobs:
- name: Install dependencies
run: |
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 install github.com/wadey/gocovmerge@latest
go get -u github.com/swaggo/swag/cmd/swag

View file

@ -25,7 +25,7 @@ jobs:
- name: Install dependencies
run: |
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
sudo apt-get update
sudo apt-get install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config rpm uidmap

View file

@ -55,7 +55,7 @@ add-extensions = $(subst $(1),$(2),$(sort $(filter-valid)))
BUILD_LABELS = $(call add-extensions,$(space),$(comma))
.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
modtidy:
@ -70,6 +70,15 @@ modcheck: modtidy
exit 1;\
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
create-name:
ifdef BUILD_LABELS
@ -95,7 +104,7 @@ binary: modcheck create-name build-metadata
.PHONY: binary-debug
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
.PHONY: cli

View file

@ -452,7 +452,6 @@ func (rh *RouteHandler) CheckManifest(response http.ResponseWriter, request *htt
response.WriteHeader(http.StatusOK)
}
// NOTE: https://github.com/swaggo/swag/issues/387.
type ImageManifest struct {
ispec.Manifest
}

View file

@ -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.",
"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",
"properties": {
"architecture": {

View file

@ -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.",
"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",
"properties": {
"architecture": {

View file

@ -185,7 +185,7 @@ definitions:
type: string
platform:
allOf:
- $ref: '#/definitions/github_com_opencontainers_image-spec_specs-go_v1.Platform'
- $ref: '#/definitions/v1.Platform'
description: |-
Platform describes the platform which the image in the manifest runs on.
@ -199,7 +199,7 @@ definitions:
type: string
type: array
type: object
github_com_opencontainers_image-spec_specs-go_v1.Platform:
v1.Platform:
properties:
architecture:
description: |-