mirror of
https://codeberg.org/crowci/crow.git
synced 2025-04-18 04:44:01 +03:00
chore: revert tab - spaces migration due to test errors
This commit is contained in:
parent
d628db511a
commit
0bd5202468
@ -9,6 +9,9 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[stepBuilder_test.go, network_test.go, container_test.go, matrix_test.go, linter_test.go param_test.go common_test.go network_test.go parse_test.go]
|
||||
indent_style = space
|
||||
|
||||
[*.go]
|
||||
indent_style = tab
|
||||
|
||||
|
@ -123,20 +123,20 @@ float: 1.2
|
||||
bool: true
|
||||
slice: [1, 2, 3]
|
||||
my_secret:
|
||||
from_secret: secret_token
|
||||
from_secret: secret_token
|
||||
map:
|
||||
key: "value"
|
||||
entry2:
|
||||
- "a"
|
||||
- "b"
|
||||
- 3
|
||||
secret:
|
||||
from_secret: secret_token
|
||||
key: "value"
|
||||
entry2:
|
||||
- "a"
|
||||
- "b"
|
||||
- 3
|
||||
secret:
|
||||
from_secret: secret_token
|
||||
list.map:
|
||||
- registry: https://codeberg.org
|
||||
username: "6543"
|
||||
password:
|
||||
from_secret: cb_password
|
||||
- registry: https://codeberg.org
|
||||
username: "6543"
|
||||
password:
|
||||
from_secret: cb_password
|
||||
`)
|
||||
var from map[string]any
|
||||
err := yaml.Unmarshal(fromYAML, &from)
|
||||
@ -173,7 +173,7 @@ list.map:
|
||||
|
||||
func TestYAMLToParamsToEnvError(t *testing.T) {
|
||||
fromYAML := []byte(`my_secret:
|
||||
from_secret: not_a_secret
|
||||
from_secret: not_a_secret
|
||||
`)
|
||||
var from map[string]any
|
||||
err := yaml.Unmarshal(fromYAML, &from)
|
||||
|
@ -28,64 +28,64 @@ func TestLint(t *testing.T) {
|
||||
testdatas := []struct{ Title, Data string }{{
|
||||
Title: "map", Data: `
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
|
||||
steps:
|
||||
build:
|
||||
image: docker
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
commands:
|
||||
- go build
|
||||
- go test
|
||||
publish:
|
||||
image: woodpeckerci/plugin-kaniko
|
||||
settings:
|
||||
repo: foo/bar
|
||||
foo: bar
|
||||
build:
|
||||
image: docker
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
commands:
|
||||
- go build
|
||||
- go test
|
||||
publish:
|
||||
image: woodpeckerci/plugin-kaniko
|
||||
settings:
|
||||
repo: foo/bar
|
||||
foo: bar
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
redis:
|
||||
image: redis
|
||||
`,
|
||||
}, {
|
||||
Title: "list", Data: `
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: docker
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
commands:
|
||||
- go build
|
||||
- go test
|
||||
- name: publish
|
||||
image: woodpeckerci/plugin-kaniko
|
||||
settings:
|
||||
repo: foo/bar
|
||||
foo: bar
|
||||
- name: build
|
||||
image: docker
|
||||
volumes:
|
||||
- /tmp:/tmp
|
||||
commands:
|
||||
- go build
|
||||
- go test
|
||||
- name: publish
|
||||
image: woodpeckerci/plugin-kaniko
|
||||
settings:
|
||||
repo: foo/bar
|
||||
foo: bar
|
||||
services:
|
||||
- name: redis
|
||||
image: redis
|
||||
- name: redis
|
||||
image: redis
|
||||
`,
|
||||
}, {
|
||||
Title: "merge maps", Data: `
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
|
||||
variables:
|
||||
step_template: &base-step
|
||||
image: golang:1.19
|
||||
commands:
|
||||
- go version
|
||||
step_template: &base-step
|
||||
image: golang:1.19
|
||||
commands:
|
||||
- go version
|
||||
|
||||
steps:
|
||||
test base step:
|
||||
<<: *base-step
|
||||
test base step with latest image:
|
||||
<<: *base-step
|
||||
image: golang:latest
|
||||
test base step:
|
||||
<<: *base-step
|
||||
test base step with latest image:
|
||||
<<: *base-step
|
||||
image: golang:latest
|
||||
`,
|
||||
}}
|
||||
|
||||
|
@ -49,26 +49,26 @@ func TestMatrixIncluded(t *testing.T) {
|
||||
|
||||
var fakeMatrix = `
|
||||
matrix:
|
||||
go_version:
|
||||
- go1
|
||||
- go1.2
|
||||
python_version:
|
||||
- 3.2
|
||||
- 3.3
|
||||
django_version:
|
||||
- 1.7
|
||||
- 1.7.1
|
||||
- 1.7.2
|
||||
redis_version:
|
||||
- 2.6
|
||||
- 2.8
|
||||
go_version:
|
||||
- go1
|
||||
- go1.2
|
||||
python_version:
|
||||
- 3.2
|
||||
- 3.3
|
||||
django_version:
|
||||
- 1.7
|
||||
- 1.7.1
|
||||
- 1.7.2
|
||||
redis_version:
|
||||
- 2.6
|
||||
- 2.8
|
||||
`
|
||||
|
||||
var fakeMatrixInclude = `
|
||||
matrix:
|
||||
include:
|
||||
- go_version: 1.5
|
||||
python_version: 3.4
|
||||
- go_version: 1.6
|
||||
python_version: 3.4
|
||||
include:
|
||||
- go_version: 1.5
|
||||
python_version: 3.4
|
||||
- go_version: 1.6
|
||||
python_version: 3.4
|
||||
`
|
||||
|
@ -123,28 +123,28 @@ func TestMatch(t *testing.T) {
|
||||
func TestParseLegacy(t *testing.T) {
|
||||
sampleYamlPipeline := `
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
platform: linux/amd64
|
||||
|
||||
steps:
|
||||
say hello:
|
||||
image: bash
|
||||
commands: echo hello
|
||||
say hello:
|
||||
image: bash
|
||||
commands: echo hello
|
||||
`
|
||||
|
||||
sampleYamlPipelineLegacyIgnore := `
|
||||
platform: windows/amd64
|
||||
labels:
|
||||
platform: linux/amd64
|
||||
platform: linux/amd64
|
||||
|
||||
steps:
|
||||
say hello:
|
||||
image: bash
|
||||
commands: echo hello
|
||||
say hello:
|
||||
image: bash
|
||||
commands: echo hello
|
||||
|
||||
pipeline:
|
||||
old crap:
|
||||
image: bash
|
||||
commands: meh!
|
||||
old crap:
|
||||
image: bash
|
||||
commands: meh!
|
||||
`
|
||||
|
||||
workflow1, err := ParseString(sampleYamlPipeline)
|
||||
@ -165,75 +165,75 @@ pipeline:
|
||||
var sampleYaml = `
|
||||
image: hello-world
|
||||
when:
|
||||
- event:
|
||||
- tester
|
||||
- tester2
|
||||
- branch:
|
||||
- tester
|
||||
- event:
|
||||
- tester
|
||||
- tester2
|
||||
- branch:
|
||||
- tester
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
workspace:
|
||||
path: src/github.com/octocat/hello-world
|
||||
base: /go
|
||||
path: src/github.com/octocat/hello-world
|
||||
base: /go
|
||||
steps:
|
||||
test:
|
||||
image: golang
|
||||
commands:
|
||||
- go install
|
||||
- go test
|
||||
build:
|
||||
image: golang
|
||||
network_mode: container:name
|
||||
commands:
|
||||
- go build
|
||||
when:
|
||||
event: push
|
||||
notify:
|
||||
image: slack
|
||||
channel: dev
|
||||
when:
|
||||
event: failure
|
||||
test:
|
||||
image: golang
|
||||
commands:
|
||||
- go install
|
||||
- go test
|
||||
build:
|
||||
image: golang
|
||||
network_mode: container:name
|
||||
commands:
|
||||
- go build
|
||||
when:
|
||||
event: push
|
||||
notify:
|
||||
image: slack
|
||||
channel: dev
|
||||
when:
|
||||
event: failure
|
||||
services:
|
||||
database:
|
||||
image: mysql
|
||||
database:
|
||||
image: mysql
|
||||
labels:
|
||||
com.example.type: "build"
|
||||
com.example.team: "frontend"
|
||||
com.example.type: "build"
|
||||
com.example.team: "frontend"
|
||||
depends_on:
|
||||
- lint
|
||||
- test
|
||||
- lint
|
||||
- test
|
||||
runs_on:
|
||||
- success
|
||||
- failure
|
||||
- success
|
||||
- failure
|
||||
`
|
||||
|
||||
var simpleYamlAnchors = `
|
||||
vars:
|
||||
image: &image plugins/slack
|
||||
image: &image plugins/slack
|
||||
steps:
|
||||
notify_success:
|
||||
image: *image
|
||||
notify_success:
|
||||
image: *image
|
||||
`
|
||||
|
||||
var sampleVarYaml = `
|
||||
_slack: &SLACK
|
||||
image: plugins/slack
|
||||
image: plugins/slack
|
||||
steps:
|
||||
notify_fail: *SLACK
|
||||
notify_success:
|
||||
<< : *SLACK
|
||||
when:
|
||||
event: success
|
||||
notify_fail: *SLACK
|
||||
notify_success:
|
||||
<< : *SLACK
|
||||
when:
|
||||
event: success
|
||||
`
|
||||
|
||||
var sampleSliceYaml = `
|
||||
steps:
|
||||
nil_slice:
|
||||
image: plugins/slack
|
||||
empty_slice:
|
||||
image: plugins/slack
|
||||
depends_on: []
|
||||
nil_slice:
|
||||
image: plugins/slack
|
||||
empty_slice:
|
||||
image: plugins/slack
|
||||
depends_on: []
|
||||
`
|
||||
|
||||
func TestSlice(t *testing.T) {
|
||||
|
@ -1,51 +0,0 @@
|
||||
// Copyright 2024 Woodpecker 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.
|
||||
|
||||
// TODO: delete file after v3.0.0 release
|
||||
|
||||
package base
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type StructMap struct {
|
||||
Foos EnvironmentMap `yaml:"foos,omitempty"`
|
||||
}
|
||||
|
||||
func TestEnvironmentMapYaml(t *testing.T) {
|
||||
str := `{foos: [bar=baz, far=faz]}`
|
||||
s := StructMap{}
|
||||
err := yaml.Unmarshal([]byte(str), &s)
|
||||
if assert.Error(t, err) {
|
||||
assert.EqualValues(t, "list syntax for 'environment' has been removed, use map syntax instead (https://woodpecker-ci.org/docs/usage/environment)", err.Error())
|
||||
}
|
||||
|
||||
s.Foos = EnvironmentMap{"bar": "baz", "far": "faz"}
|
||||
d, err := yaml.Marshal(&s)
|
||||
assert.NoError(t, err)
|
||||
str = `foos:
|
||||
bar: baz
|
||||
far: faz
|
||||
`
|
||||
assert.EqualValues(t, str, string(d))
|
||||
|
||||
s2 := StructMap{}
|
||||
assert.NoError(t, yaml.Unmarshal(d, &s2))
|
||||
|
||||
assert.Equal(t, EnvironmentMap{"bar": "baz", "far": "faz"}, s2.Foos)
|
||||
}
|
@ -28,46 +28,46 @@ import (
|
||||
var containerYaml = []byte(`
|
||||
image: golang:latest
|
||||
commands:
|
||||
- go build
|
||||
- go test
|
||||
- go build
|
||||
- go test
|
||||
detach: true
|
||||
devices:
|
||||
- /dev/ttyUSB0:/dev/ttyUSB0
|
||||
- /dev/ttyUSB0:/dev/ttyUSB0
|
||||
directory: example/
|
||||
dns: 8.8.8.8
|
||||
dns_search: example.com
|
||||
entrypoint: [/bin/sh, -c]
|
||||
environment:
|
||||
RACK_ENV: development
|
||||
SHOW: true
|
||||
RACK_ENV: development
|
||||
SHOW: true
|
||||
extra_hosts:
|
||||
- somehost:162.242.195.82
|
||||
- otherhost:50.31.209.229
|
||||
- ipv6:2001:db8::10
|
||||
- somehost:162.242.195.82
|
||||
- otherhost:50.31.209.229
|
||||
- ipv6:2001:db8::10
|
||||
name: my-build-container
|
||||
network_mode: bridge
|
||||
networks:
|
||||
- some-network
|
||||
- other-network
|
||||
- some-network
|
||||
- other-network
|
||||
pull: true
|
||||
privileged: true
|
||||
volumes:
|
||||
- /var/lib/mysql
|
||||
- /opt/data:/var/lib/mysql
|
||||
- /etc/configs:/etc/configs/:ro
|
||||
- /var/lib/mysql
|
||||
- /opt/data:/var/lib/mysql
|
||||
- /etc/configs:/etc/configs/:ro
|
||||
tmpfs:
|
||||
- /var/lib/test
|
||||
- /var/lib/test
|
||||
when:
|
||||
- branch: main
|
||||
- event: cron
|
||||
cron: job1
|
||||
- branch: main
|
||||
- event: cron
|
||||
cron: job1
|
||||
settings:
|
||||
foo: bar
|
||||
baz: false
|
||||
foo: bar
|
||||
baz: false
|
||||
ports:
|
||||
- 8080
|
||||
- 4443/tcp
|
||||
- 51820/udp
|
||||
- 8080
|
||||
- 4443/tcp
|
||||
- 51820/udp
|
||||
`)
|
||||
|
||||
func TestUnmarshalContainer(t *testing.T) {
|
||||
@ -152,15 +152,15 @@ func TestUnmarshalContainers(t *testing.T) {
|
||||
},
|
||||
{
|
||||
from: `publish-agent:
|
||||
image: print/env
|
||||
settings:
|
||||
repo: woodpeckerci/woodpecker-agent
|
||||
dry_run: true
|
||||
dockerfile: docker/Dockerfile.agent
|
||||
tag: [next, latest]
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push`,
|
||||
image: print/env
|
||||
settings:
|
||||
repo: woodpeckerci/woodpecker-agent
|
||||
dry_run: true
|
||||
dockerfile: docker/Dockerfile.agent
|
||||
tag: [next, latest]
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push`,
|
||||
want: []*Container{
|
||||
{
|
||||
Name: "publish-agent",
|
||||
@ -184,14 +184,14 @@ func TestUnmarshalContainers(t *testing.T) {
|
||||
},
|
||||
{
|
||||
from: `publish-cli:
|
||||
image: print/env
|
||||
settings:
|
||||
repo: woodpeckerci/woodpecker-cli
|
||||
dockerfile: docker/Dockerfile.cli
|
||||
tag: [next]
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push`,
|
||||
image: print/env
|
||||
settings:
|
||||
repo: woodpeckerci/woodpecker-cli
|
||||
dockerfile: docker/Dockerfile.cli
|
||||
tag: [next]
|
||||
when:
|
||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push`,
|
||||
want: []*Container{
|
||||
{
|
||||
Name: "publish-cli",
|
||||
@ -214,11 +214,11 @@ func TestUnmarshalContainers(t *testing.T) {
|
||||
},
|
||||
{
|
||||
from: `publish-cli:
|
||||
image: print/env
|
||||
when:
|
||||
- branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
- event: pull_request`,
|
||||
image: print/env
|
||||
when:
|
||||
- branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||
event: push
|
||||
- event: pull_request`,
|
||||
want: []*Container{
|
||||
{
|
||||
Name: "publish-cli",
|
||||
|
@ -58,9 +58,9 @@ network2: {}
|
||||
},
|
||||
},
|
||||
expected: `network1:
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2
|
||||
network2: {}
|
||||
`,
|
||||
},
|
||||
@ -79,12 +79,12 @@ network2: {}
|
||||
},
|
||||
},
|
||||
expected: `network1:
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2
|
||||
network2:
|
||||
ipv4_address: 172.16.238.10
|
||||
ipv6_address: 2001:3984:3989::10
|
||||
ipv4_address: 172.16.238.10
|
||||
ipv6_address: 2001:3984:3989::10
|
||||
`,
|
||||
},
|
||||
}
|
||||
@ -136,9 +136,9 @@ func TestUnmarshalNetworks(t *testing.T) {
|
||||
},
|
||||
{
|
||||
yaml: `network1:
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2`,
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2`,
|
||||
expected: &Networks{
|
||||
Networks: []*Network{
|
||||
{
|
||||
@ -150,11 +150,11 @@ func TestUnmarshalNetworks(t *testing.T) {
|
||||
},
|
||||
{
|
||||
yaml: `network1:
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2
|
||||
ipv4_address: 172.16.238.10
|
||||
ipv6_address: 2001:3984:3989::10`,
|
||||
aliases:
|
||||
- alias1
|
||||
- alias2
|
||||
ipv4_address: 172.16.238.10
|
||||
ipv6_address: 2001:3984:3989::10`,
|
||||
expected: &Networks{
|
||||
Networks: []*Network{
|
||||
{
|
||||
|
@ -50,12 +50,12 @@ func TestGlobalEnvsubst(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: ${IMAGE}
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
build:
|
||||
image: ${IMAGE}
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -89,12 +89,12 @@ func TestMissingGlobalEnvsubst(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: ${IMAGE}
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
build:
|
||||
image: ${IMAGE}
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -124,21 +124,21 @@ bbb`,
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
xxx:
|
||||
image: scratch
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
xxx:
|
||||
image: scratch
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
`)},
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
build:
|
||||
image: scratch
|
||||
settings:
|
||||
yyy: ${CI_COMMIT_MESSAGE}
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -167,17 +167,17 @@ func TestMultiPipeline(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
xxx:
|
||||
image: scratch
|
||||
xxx:
|
||||
image: scratch
|
||||
`)},
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -208,28 +208,28 @@ func TestDependsOn(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Name: "lint", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
{Name: "test", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
deploy:
|
||||
image: scratch
|
||||
deploy:
|
||||
image: scratch
|
||||
|
||||
depends_on:
|
||||
- lint
|
||||
- test
|
||||
- lint
|
||||
- test
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -263,14 +263,14 @@ func TestRunsOn(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
deploy:
|
||||
image: scratch
|
||||
deploy:
|
||||
image: scratch
|
||||
|
||||
runs_on:
|
||||
- success
|
||||
- failure
|
||||
- success
|
||||
- failure
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -304,17 +304,17 @@ func TestPipelineName(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Name: ".crow/lint.yml", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
{Name: ".crow/.test.yml", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -347,18 +347,18 @@ func TestBranchFilter(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
event: push
|
||||
branch: main
|
||||
steps:
|
||||
xxx:
|
||||
image: scratch
|
||||
xxx:
|
||||
image: scratch
|
||||
`)},
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -390,24 +390,24 @@ func TestRootWhenFilter(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
event:
|
||||
- tag
|
||||
steps:
|
||||
xxx:
|
||||
image: scratch
|
||||
xxx:
|
||||
image: scratch
|
||||
`)},
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
event:
|
||||
- push
|
||||
steps:
|
||||
xxx:
|
||||
image: scratch
|
||||
xxx:
|
||||
image: scratch
|
||||
`)},
|
||||
{Data: []byte(`
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -440,13 +440,13 @@ func TestZeroSteps(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
skip_clone: true
|
||||
steps:
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
`)},
|
||||
},
|
||||
}
|
||||
@ -480,27 +480,27 @@ func TestZeroStepsAsMultiPipelineDeps(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Name: "zerostep", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
skip_clone: true
|
||||
steps:
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
`)},
|
||||
{Name: "justastep", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
{Name: "shouldbefiltered", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
depends_on: [ zerostep ]
|
||||
`)},
|
||||
},
|
||||
@ -538,35 +538,35 @@ func TestZeroStepsAsMultiPipelineTransitiveDeps(t *testing.T) {
|
||||
Yamls: []*forge_types.FileMeta{
|
||||
{Name: "zerostep", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
skip_clone: true
|
||||
steps:
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
build:
|
||||
when:
|
||||
branch: notdev
|
||||
image: scratch
|
||||
`)},
|
||||
{Name: "justastep", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
`)},
|
||||
{Name: "shouldbefiltered", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
depends_on: [ zerostep ]
|
||||
`)},
|
||||
{Name: "shouldbefilteredtoo", Data: []byte(`
|
||||
when:
|
||||
event: push
|
||||
event: push
|
||||
steps:
|
||||
build:
|
||||
image: scratch
|
||||
build:
|
||||
image: scratch
|
||||
depends_on: [ shouldbefiltered ]
|
||||
`)},
|
||||
},
|
||||
|
@ -49,10 +49,10 @@ func TestNormalizeSQLiteTableSchema(t *testing.T) {
|
||||
"repo_visibility TEXT, repo_counter INTEGER, repo_active BOOLEAN, "+
|
||||
"repo_fallback BOOLEAN, UNIQUE(repo_full_name) )",
|
||||
normalizeSQLiteTableSchema(`CREATE TABLE repos (
|
||||
repo_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||
repo_id INTEGER PRIMARY KEY AUTOINCREMENT
|
||||
,repo_user_id INTEGER
|
||||
,repo_owner TEXT,
|
||||
repo_name TEXT
|
||||
repo_name TEXT
|
||||
,repo_full_name TEXT
|
||||
,`+"`"+`repo_avatar`+"`"+` TEXT
|
||||
,repo_link TEXT
|
||||
|
Loading…
x
Reference in New Issue
Block a user