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,10 +1,10 @@
name: Bug report
description: File a bug report
title: "[Bug]: "
labels: bug
title: "[Bug]: "
labels: ["bug"]
body:
- type: input
attributes:
attributes:
label: "zot version"
placeholder: "v1.4.3 or commit hash"
validations:
@ -23,12 +23,12 @@ body:
1. Configuration
2. Client tool used
3. Seen error
- type: textarea
attributes:
label: "Expected behavior"
description: "A clear and concise description of what you expected to happen."
- type: textarea
attributes:
label: "Screenshots"

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

@ -88,11 +88,11 @@ jobs:
pip install localstack # Install LocalStack cli
docker pull localstack/localstack:1.3 # Make sure to pull the latest version of the image
localstack start -d # Start LocalStack in the background
echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container
localstack wait -t 30 # to become ready before timing out
localstack wait -t 30 # to become ready before timing out
echo "Startup complete"
aws --endpoint-url=http://localhost:4566 s3api create-bucket --bucket zot-storage --region us-east-2 --create-bucket-configuration="{\"LocationConstraint\": \"us-east-2\"}"
aws dynamodb --endpoint-url http://localhost:4566 --region "us-east-2" create-table --table-name BlobTable --attribute-definitions AttributeName=Digest,AttributeType=S --key-schema AttributeName=Digest,KeyType=HASH --provisioned-throughput ReadCapacityUnits=10,WriteCapacityUnits=5
env:

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
@ -56,7 +56,7 @@ jobs:
minio/minio:edge-cicd server /data
- name: Install py minio
run: pip3 install minio
- name: Wait for minio to come up
run: |
curl --connect-timeout 5 \
@ -64,7 +64,7 @@ jobs:
--retry 12 \
--retry-max-time 120 \
'http://localhost:9000/minio/health/live'
- name: Create minio bucket
run: |
python3 - <<'EOF'
@ -88,7 +88,7 @@ jobs:
run: |
sudo haproxy -d -f examples/cluster/haproxy.cfg -D
sleep 10
- name: Prepare configuration files
run: |
cp test/cluster/config-minio.json test/cluster/config-minio1.json
@ -96,7 +96,7 @@ jobs:
cp test/cluster/config-minio.json test/cluster/config-minio2.json
sed -i 's/8082/8083/g' test/cluster/config-minio.json
cp test/cluster/config-minio.json test/cluster/config-minio3.json
- name: Run push-pull tests
run: |
make binary
@ -124,7 +124,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
- name: Run benchmark with --src-cidr arg
run: |
make bench
@ -142,7 +142,7 @@ jobs:
env:
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
- name: Run benchmark with --src-ips arg
run: |
make bench
@ -152,12 +152,12 @@ jobs:
sleep 10
# run zb with --src-ips
bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-ips 127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5,127.0.0.6,127.0.12.5,127.0.12.6 http://localhost:8080
killall -r zot-*
env:
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
# Download previous benchmark result from cache (if exists)
- name: Download previous benchmark data
uses: actions/cache@v3

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
@ -72,7 +72,7 @@ jobs:
run: |
make test-bats-referrers
- name: Run metadata tests
run: |
run: |
make test-bats-metadata
- name: Run push-pull tests
run: |
@ -101,10 +101,10 @@ jobs:
pip install localstack awscli-local[ver1] # install LocalStack cli and awslocal
docker pull localstack/localstack # Make sure to pull the latest version of the image
localstack start -d # Start LocalStack in the background
echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container
localstack wait -t 30 # to become ready before timing out
echo "Startup complete"
localstack wait -t 30 # to become ready before timing out
echo "Startup complete"
- name: Run cloud-only tests
run: |
make test-cloud-only

View file

@ -22,7 +22,7 @@ jobs:
with:
cache: false
go-version: 1.20.x
- name: Run zb
run: |
make binary

View file

@ -3,7 +3,7 @@ on:
schedule:
- cron: '30 1 * * *'
workflow_dispatch:
permissions: read-all
# Here we are running two tests:
@ -40,10 +40,10 @@ jobs:
pip install localstack awscli-local[ver1] # install LocalStack cli and awslocal
docker pull localstack/localstack # Make sure to pull the latest version of the image
localstack start -d # Start LocalStack in the background
echo "Waiting for LocalStack startup..." # Wait 30 seconds for the LocalStack container
localstack wait -t 30 # to become ready before timing out
echo "Startup complete"
localstack wait -t 30 # to become ready before timing out
echo "Startup complete"
- name: Run restore s3 blobs after cache is deleted
run: |
make test-restore-s3-blobs

View file

@ -6,7 +6,7 @@ name: conformance
# or API.
on:
push:
branches:
branches:
- main
pull_request:
branches:
@ -25,7 +25,7 @@ jobs:
with:
cache: false
go-version: 1.20.x
- name: Checkout this PR
- name: Checkout this PR
uses: actions/checkout@v3
- name: Start zot server
run: |
@ -57,7 +57,7 @@ jobs:
OCI_REFERRERS: 1
OCI_CROSSMOUNT_NAMESPACE: oci-conformance/crossmount-test
run: |
./conformance.test
./conformance.test
- run: mkdir -p .out/ && mv {report.html,junit.xml} .out/
if: always()
- name: Upload test results zip as build artifact

View file

@ -22,7 +22,7 @@ jobs:
# Needs for private repositories.
contents: read
actions: read
steps:
- name: "Checkout code"
uses: actions/checkout@v3 # v3.0.0
@ -41,8 +41,8 @@ jobs:
# repo_token: ${{ secrets.SCORECARD_READ_TOKEN }}
# Publish the results for public repositories to enable scorecard badges. For more details, see
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories, `publish_results` will automatically be set to `false`, regardless
# of the value entered here.
publish_results: true
@ -54,7 +54,7 @@ jobs:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@v2.21.4 # v1.0.26

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: |-