mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-20 22:28:35 +00:00
Merge branch 'origin/main' into 'next-release/main'
This commit is contained in:
commit
cc55386e02
3 changed files with 13 additions and 7 deletions
|
@ -7,7 +7,7 @@ when:
|
|||
variables:
|
||||
- &golang_image 'docker.io/golang:1.23'
|
||||
- &node_image 'docker.io/node:23-alpine'
|
||||
- &xgo_image 'docker.io/techknowlogick/xgo:go-1.22.x'
|
||||
- &xgo_image 'docker.io/techknowlogick/xgo:go-1.23.x'
|
||||
|
||||
# cspell:words bindata netgo
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
variables:
|
||||
- &golang_image 'docker.io/golang:1.23'
|
||||
- &node_image 'docker.io/node:23-alpine'
|
||||
- &xgo_image 'docker.io/techknowlogick/xgo:go-1.22.x'
|
||||
- &xgo_image 'docker.io/techknowlogick/xgo:go-1.23.x'
|
||||
- &buildx_plugin 'docker.io/woodpeckerci/plugin-docker-buildx:5.0.0'
|
||||
- &platforms_release 'linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/386,linux/amd64,linux/ppc64le,linux/riscv64,linux/s390x,freebsd/arm64,freebsd/amd64,openbsd/arm64,openbsd/amd64'
|
||||
- &platforms_server 'linux/arm/v7,linux/arm64/v8,linux/amd64,linux/ppc64le,linux/riscv64'
|
||||
|
|
|
@ -24,6 +24,7 @@ package main
|
|||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
|
@ -57,6 +58,7 @@ func main() {
|
|||
|
||||
// convert to OpenApi3
|
||||
if err := toOpenApi3(filePath, filePath); err != nil {
|
||||
fmt.Printf("converting '%s' from openapi v2 to v3 failed\n", filePath)
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -77,18 +79,18 @@ func removeHost(jsonIn string) (string, error) {
|
|||
func toOpenApi3(input, output string) error {
|
||||
data2, err := os.ReadFile(input)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("read input: %w", err)
|
||||
}
|
||||
|
||||
var doc2 openapi2.T
|
||||
err = json.Unmarshal(data2, &doc2)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("unmarshal input: %w", err)
|
||||
}
|
||||
|
||||
doc3, err := openapi2conv.ToV3(&doc2)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("convert openapi v2 to v3: %w", err)
|
||||
}
|
||||
err = doc3.Validate(context.Background())
|
||||
if err != nil {
|
||||
|
@ -97,8 +99,12 @@ func toOpenApi3(input, output string) error {
|
|||
|
||||
data, err := json.Marshal(doc3)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("Marshal converted: %w", err)
|
||||
}
|
||||
|
||||
return os.WriteFile(output, data, 0o644)
|
||||
if err = os.WriteFile(output, data, 0o644); err != nil {
|
||||
return fmt.Errorf("write output: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue