fix compiler unit tests, hook up daemon
This commit is contained in:
@@ -12,6 +12,8 @@ import (
|
||||
"github.com/drone-runners/drone-runner-docker/engine/resource"
|
||||
"github.com/drone/drone-go/drone"
|
||||
"github.com/drone/runner-go/manifest"
|
||||
"github.com/drone/runner-go/registry"
|
||||
"github.com/drone/runner-go/secret"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/google/go-cmp/cmp/cmpopts"
|
||||
@@ -24,6 +26,10 @@ func TestClone(t *testing.T) {
|
||||
}()
|
||||
|
||||
c := &Compiler{
|
||||
Registry: registry.Static(nil),
|
||||
Secret: secret.Static(nil),
|
||||
}
|
||||
args := Args{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{},
|
||||
Stage: &drone.Stage{},
|
||||
@@ -37,12 +43,19 @@ func TestClone(t *testing.T) {
|
||||
ID: "random",
|
||||
Image: "drone/git:1",
|
||||
Name: "clone",
|
||||
Pull: engine.PullDefault,
|
||||
RunPolicy: engine.RunAlways,
|
||||
WorkingDir: "/drone/src",
|
||||
Volumes: []*engine.VolumeMount{
|
||||
&engine.VolumeMount{
|
||||
Name: "_workspace",
|
||||
Path: "/drone/src",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
got := c.Compile(nil)
|
||||
ignore := cmpopts.IgnoreFields(engine.Step{}, "Envs")
|
||||
got := c.Compile(nocontext, args)
|
||||
ignore := cmpopts.IgnoreFields(engine.Step{}, "Envs", "Labels")
|
||||
if diff := cmp.Diff(got.Steps, want, ignore); len(diff) != 0 {
|
||||
t.Errorf(diff)
|
||||
}
|
||||
@@ -50,6 +63,10 @@ func TestClone(t *testing.T) {
|
||||
|
||||
func TestCloneDisable(t *testing.T) {
|
||||
c := &Compiler{
|
||||
Registry: registry.Static(nil),
|
||||
Secret: secret.Static(nil),
|
||||
}
|
||||
args := Args{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{},
|
||||
Stage: &drone.Stage{},
|
||||
@@ -58,7 +75,7 @@ func TestCloneDisable(t *testing.T) {
|
||||
Manifest: &manifest.Manifest{},
|
||||
Pipeline: &resource.Pipeline{Clone: manifest.Clone{Disable: true}},
|
||||
}
|
||||
got := c.Compile(nil)
|
||||
got := c.Compile(nocontext, args)
|
||||
if len(got.Steps) != 0 {
|
||||
t.Errorf("Expect no clone step added when disabled")
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
"github.com/drone-runners/drone-runner-docker/engine/resource"
|
||||
"github.com/drone/drone-go/drone"
|
||||
"github.com/drone/runner-go/manifest"
|
||||
"github.com/drone/runner-go/registry"
|
||||
"github.com/drone/runner-go/secret"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
@@ -82,7 +83,7 @@ func TestCompile_RunAlways(t *testing.T) {
|
||||
|
||||
// This test verifies that steps configured to run on failure
|
||||
// are configured to run on failure.
|
||||
func TestCompile_RunFaiure(t *testing.T) {
|
||||
func TestCompile_RunFailure(t *testing.T) {
|
||||
ir := testCompile(t, "testdata/run_failure.yml", "testdata/run_failure.json")
|
||||
if ir.Steps[0].RunPolicy != engine.RunOnFailure {
|
||||
t.Errorf("Expect run on failure")
|
||||
@@ -94,20 +95,27 @@ func TestCompile_RunFaiure(t *testing.T) {
|
||||
// at compile time.
|
||||
func TestCompile_Secrets(t *testing.T) {
|
||||
manifest, _ := manifest.ParseFile("testdata/secret.yml")
|
||||
compiler := Compiler{}
|
||||
compiler.Build = &drone.Build{}
|
||||
compiler.Repo = &drone.Repo{}
|
||||
compiler.Stage = &drone.Stage{}
|
||||
compiler.System = &drone.System{}
|
||||
compiler.Netrc = &drone.Netrc{}
|
||||
compiler.Manifest = manifest
|
||||
compiler.Pipeline = manifest.Resources[0].(*resource.Pipeline)
|
||||
compiler.Secret = secret.StaticVars(map[string]string{
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"password": "password",
|
||||
"my_username": "octocat",
|
||||
})
|
||||
ir := compiler.Compile(nocontext)
|
||||
|
||||
compiler := &Compiler{
|
||||
Registry: registry.Static(nil),
|
||||
Secret: secret.StaticVars(map[string]string{
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"password": "password",
|
||||
"my_username": "octocat",
|
||||
}),
|
||||
}
|
||||
args := Args{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{},
|
||||
Stage: &drone.Stage{},
|
||||
System: &drone.System{},
|
||||
Netrc: &drone.Netrc{},
|
||||
Manifest: manifest,
|
||||
Pipeline: manifest.Resources[0].(*resource.Pipeline),
|
||||
Secret: secret.Static(nil),
|
||||
}
|
||||
|
||||
ir := compiler.Compile(nocontext, args)
|
||||
got := ir.Steps[0].Secrets
|
||||
want := []*engine.Secret{
|
||||
{
|
||||
@@ -149,15 +157,26 @@ func testCompile(t *testing.T, source, golden string) *engine.Spec {
|
||||
return nil
|
||||
}
|
||||
|
||||
compiler := Compiler{}
|
||||
compiler.Build = &drone.Build{Target: "master"}
|
||||
compiler.Repo = &drone.Repo{}
|
||||
compiler.Stage = &drone.Stage{}
|
||||
compiler.System = &drone.System{}
|
||||
compiler.Netrc = &drone.Netrc{Machine: "github.com", Login: "octocat", Password: "correct-horse-battery-staple"}
|
||||
compiler.Manifest = manifest
|
||||
compiler.Pipeline = manifest.Resources[0].(*resource.Pipeline)
|
||||
got := compiler.Compile(nocontext)
|
||||
compiler := &Compiler{
|
||||
Registry: registry.Static(nil),
|
||||
Secret: secret.StaticVars(map[string]string{
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"password": "password",
|
||||
"my_username": "octocat",
|
||||
}),
|
||||
}
|
||||
args := Args{
|
||||
Repo: &drone.Repo{},
|
||||
Build: &drone.Build{Target: "master"},
|
||||
Stage: &drone.Stage{},
|
||||
System: &drone.System{},
|
||||
Netrc: &drone.Netrc{Machine: "github.com", Login: "octocat", Password: "correct-horse-battery-staple"},
|
||||
Manifest: manifest,
|
||||
Pipeline: manifest.Resources[0].(*resource.Pipeline),
|
||||
Secret: secret.Static(nil),
|
||||
}
|
||||
|
||||
got := compiler.Compile(nocontext, args)
|
||||
|
||||
raw, err := ioutil.ReadFile(golden)
|
||||
if err != nil {
|
||||
@@ -170,10 +189,15 @@ func testCompile(t *testing.T, source, golden string) *engine.Spec {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
ignore := cmpopts.IgnoreFields(engine.Step{}, "Envs", "Secrets")
|
||||
unexported := cmpopts.IgnoreUnexported(engine.Spec{})
|
||||
if diff := cmp.Diff(got, want, ignore, unexported); len(diff) != 0 {
|
||||
opts := cmp.Options{
|
||||
cmpopts.IgnoreUnexported(engine.Spec{}),
|
||||
cmpopts.IgnoreFields(engine.Step{}, "Envs", "Secrets", "Labels"),
|
||||
cmpopts.IgnoreFields(engine.Network{}, "Labels"),
|
||||
cmpopts.IgnoreFields(engine.VolumeEmptyDir{}, "Labels"),
|
||||
}
|
||||
if diff := cmp.Diff(got, want, opts...); len(diff) != 0 {
|
||||
t.Errorf(diff)
|
||||
dump(got)
|
||||
}
|
||||
|
||||
return got
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Polyform License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/drone/runner-go/shell/bash"
|
||||
"github.com/drone/runner-go/shell/powershell"
|
||||
)
|
||||
|
||||
// helper function returns the base temporary directory based
|
||||
// on the target platform.
|
||||
func tempdir(os string) string {
|
||||
dir := fmt.Sprintf("drone-%s", random())
|
||||
switch os {
|
||||
case "windows":
|
||||
return join(os, "C:\\Windows\\Temp", dir)
|
||||
default:
|
||||
return join(os, "/tmp", dir)
|
||||
}
|
||||
}
|
||||
|
||||
// helper function joins the file paths.
|
||||
func join(os string, paths ...string) string {
|
||||
switch os {
|
||||
case "windows":
|
||||
return strings.Join(paths, "\\")
|
||||
default:
|
||||
return strings.Join(paths, "/")
|
||||
}
|
||||
}
|
||||
|
||||
// helper function returns the shell extension based on the
|
||||
// target platform.
|
||||
func getExt(os, file string) (s string) {
|
||||
switch os {
|
||||
case "windows":
|
||||
return file + ".ps1"
|
||||
default:
|
||||
return file
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TODO(bradrydzewski) can we remove the below functions?
|
||||
//
|
||||
|
||||
// helper function returns the shell command and arguments
|
||||
// based on the target platform to invoke the script
|
||||
func getCommand(os, script string) (string, []string) {
|
||||
cmd, args := bash.Command()
|
||||
switch os {
|
||||
case "windows":
|
||||
cmd, args = powershell.Command()
|
||||
}
|
||||
return cmd, append(args, script)
|
||||
}
|
||||
|
||||
// helper function returns the netrc file name based on the
|
||||
// target platform.
|
||||
func getNetrc(os string) string {
|
||||
switch os {
|
||||
case "windows":
|
||||
return "_netrc"
|
||||
default:
|
||||
return ".netrc"
|
||||
}
|
||||
}
|
||||
|
||||
// helper function generates and returns a shell script to
|
||||
// execute the provided shell commands. The shell scripting
|
||||
// language (bash vs pwoershell) is determined by the operating
|
||||
// system.
|
||||
func genScript(os string, commands []string) string {
|
||||
switch os {
|
||||
case "windows":
|
||||
return powershell.Script(commands)
|
||||
default:
|
||||
return bash.Script(commands)
|
||||
}
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Polyform License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package compiler
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/drone/runner-go/shell/bash"
|
||||
"github.com/drone/runner-go/shell/powershell"
|
||||
|
||||
"github.com/dchest/uniuri"
|
||||
)
|
||||
|
||||
func Test_tempdir(t *testing.T) {
|
||||
// replace the default random function with one that
|
||||
// is deterministic, for testing purposes.
|
||||
random = notRandom
|
||||
|
||||
// restore the default random function and the previously
|
||||
// specified temporary directory
|
||||
defer func() {
|
||||
random = uniuri.New
|
||||
}()
|
||||
|
||||
tests := []struct {
|
||||
os string
|
||||
path string
|
||||
}{
|
||||
{os: "windows", path: "C:\\Windows\\Temp\\drone-random"},
|
||||
{os: "linux", path: "/tmp/drone-random"},
|
||||
{os: "openbsd", path: "/tmp/drone-random"},
|
||||
{os: "netbsd", path: "/tmp/drone-random"},
|
||||
{os: "freebsd", path: "/tmp/drone-random"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
if got, want := tempdir(test.os), test.path; got != want {
|
||||
t.Errorf("Want tempdir %s, got %s", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_join(t *testing.T) {
|
||||
tests := []struct {
|
||||
os string
|
||||
a []string
|
||||
b string
|
||||
}{
|
||||
{os: "windows", a: []string{"C:", "Windows", "Temp"}, b: "C:\\Windows\\Temp"},
|
||||
{os: "linux", a: []string{"/tmp", "foo", "bar"}, b: "/tmp/foo/bar"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
if got, want := join(test.os, test.a...), test.b; got != want {
|
||||
t.Errorf("Want %s, got %s", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getExt(t *testing.T) {
|
||||
tests := []struct {
|
||||
os string
|
||||
a string
|
||||
b string
|
||||
}{
|
||||
{os: "windows", a: "clone", b: "clone.ps1"},
|
||||
{os: "linux", a: "clone", b: "clone"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
if got, want := getExt(test.os, test.a), test.b; got != want {
|
||||
t.Errorf("Want %s, got %s", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getCommand(t *testing.T) {
|
||||
cmd, args := getCommand("linux", "clone.sh")
|
||||
if got, want := cmd, "/bin/sh"; got != want {
|
||||
t.Errorf("Want command %s, got %s", want, got)
|
||||
}
|
||||
if !reflect.DeepEqual(args, []string{"-e", "clone.sh"}) {
|
||||
t.Errorf("Unexpected args %v", args)
|
||||
}
|
||||
|
||||
cmd, args = getCommand("windows", "clone.ps1")
|
||||
if got, want := cmd, "powershell"; got != want {
|
||||
t.Errorf("Want command %s, got %s", want, got)
|
||||
}
|
||||
if !reflect.DeepEqual(args, []string{"-noprofile", "-noninteractive", "-command", "clone.ps1"}) {
|
||||
t.Errorf("Unexpected args %v", args)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getNetrc(t *testing.T) {
|
||||
tests := []struct {
|
||||
os string
|
||||
name string
|
||||
}{
|
||||
{os: "windows", name: "_netrc"},
|
||||
{os: "linux", name: ".netrc"},
|
||||
{os: "openbsd", name: ".netrc"},
|
||||
{os: "netbsd", name: ".netrc"},
|
||||
{os: "freebsd", name: ".netrc"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
if got, want := getNetrc(test.os), test.name; got != want {
|
||||
t.Errorf("Want %s on %s, got %s", want, test.os, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Test_getScript(t *testing.T) {
|
||||
commands := []string{"go build"}
|
||||
|
||||
a := genScript("windows", commands)
|
||||
b := powershell.Script(commands)
|
||||
if !reflect.DeepEqual(a, b) {
|
||||
t.Errorf("Generated windows linux script")
|
||||
}
|
||||
|
||||
a = genScript("linux", commands)
|
||||
b = bash.Script(commands)
|
||||
if !reflect.DeepEqual(a, b) {
|
||||
t.Errorf("Generated invalid linux script")
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
"github.com/drone-runners/drone-runner-docker/engine/resource"
|
||||
)
|
||||
|
||||
// helper function configures the pipeline script for the
|
||||
// target operating system.
|
||||
func setupScript(src *resource.Step, dst *engine.Step, os string) {
|
||||
if len(src.Commands) > 0 {
|
||||
switch os {
|
||||
@@ -22,12 +24,16 @@ func setupScript(src *resource.Step, dst *engine.Step, os string) {
|
||||
}
|
||||
}
|
||||
|
||||
// helper function configures the pipeline script for the
|
||||
// windows operating system.
|
||||
func setupScriptWindows(src *resource.Step, dst *engine.Step) {
|
||||
dst.Entrypoint = []string{"powershell", "-noprofile", "-noninteractive", "-command"}
|
||||
dst.Command = []string{"echo $DRONE_SCRIPT | iex"}
|
||||
dst.Envs["DRONE_SCRIPT"] = powershell.Script(src.Commands)
|
||||
}
|
||||
|
||||
// helper function configures the pipeline script for the
|
||||
// linux operating system.
|
||||
func setupScriptPosix(src *resource.Step, dst *engine.Step) {
|
||||
dst.Entrypoint = []string{"/bin/sh", "-c"}
|
||||
dst.Command = []string{`echo "$DRONE_SCRIPT" | /bin/sh`}
|
||||
|
||||
412
engine/compiler/testdata/graph.json
vendored
412
engine/compiler/testdata/graph.json
vendored
@@ -1,104 +1,366 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/clone"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"id": "random",
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571810984",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571810984",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571810984",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571810984",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"image": "drone/git:1",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810984",
|
||||
"io.drone.expires": "1571814584",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "clone",
|
||||
"run_policy": "always",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/clone",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnaXQgaW5pdCIKZ2l0IGluaXQKCmVjaG8gKyAiZ2l0IHJlbW90ZSBhZGQgb3JpZ2luICIKZ2l0IHJlbW90ZSBhZGQgb3JpZ2luIAoKZWNobyArICJnaXQgZmV0Y2ggIG9yaWdpbiArcmVmcy9oZWFkcy9tYXN0ZXI6IgpnaXQgZmV0Y2ggIG9yaWdpbiArcmVmcy9oZWFkcy9tYXN0ZXI6CgplY2hvICsgImdpdCBjaGVja291dCAgLWIgbWFzdGVyIgpnaXQgY2hlY2tvdXQgIC1iIG1hc3Rlcgo="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"secrets": [],
|
||||
"name": "clone",
|
||||
"run_policy": 2,
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
},
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"depends_on": [
|
||||
"clone"
|
||||
],
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571810984",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571810984",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go build\"\ngo build\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571810984",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571810984",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810984",
|
||||
"io.drone.expires": "1571814584",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "build",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQK"
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"secrets": [],
|
||||
"name": "build",
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
},
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/test"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"depends_on": [
|
||||
"build"
|
||||
],
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571810984",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571810984",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go test\"\ngo test\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571810984",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571810984",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810984",
|
||||
"io.drone.expires": "1571814584",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "test",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/test",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyB0ZXN0IgpnbyB0ZXN0Cg=="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"secrets": [],
|
||||
"name": "test",
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810984",
|
||||
"io.drone.expires": "1571814584",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810984",
|
||||
"io.drone.expires": "1571814584",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
304
engine/compiler/testdata/match.json
vendored
304
engine/compiler/testdata/match.json
vendored
@@ -1,82 +1,264 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571811065",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571811065",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go build\"\ngo build\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571811065",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571811065",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811065",
|
||||
"io.drone.expires": "1571814665",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "build",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQK"
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "build",
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
},
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/test"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"depends_on": [
|
||||
"build"
|
||||
],
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571811065",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571811065",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go test\"\ngo test\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571811065",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571811065",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811065",
|
||||
"io.drone.expires": "1571814665",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "test",
|
||||
"run_policy": "never",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/test",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyB0ZXN0IgpnbyB0ZXN0Cg=="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "test",
|
||||
"run_policy": 3,
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811065",
|
||||
"io.drone.expires": "1571814665",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811065",
|
||||
"io.drone.expires": "1571814665",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
304
engine/compiler/testdata/noclone_graph.json
vendored
304
engine/compiler/testdata/noclone_graph.json
vendored
@@ -1,83 +1,263 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571811036",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571811036",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go build\"\ngo build\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571811036",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571811036",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811036",
|
||||
"io.drone.expires": "1571814636",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "build",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQK"
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "build",
|
||||
"secrets": [],
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
},
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/test"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"depends_on": [
|
||||
"build"
|
||||
],
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571811036",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571811036",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go test\"\ngo test\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571811036",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571811036",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811036",
|
||||
"io.drone.expires": "1571814636",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "test",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/test",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyB0ZXN0IgpnbyB0ZXN0Cg=="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "test",
|
||||
"secrets": [],
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811036",
|
||||
"io.drone.expires": "1571814636",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811036",
|
||||
"io.drone.expires": "1571814636",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
194
engine/compiler/testdata/noclone_serial.json
vendored
194
engine/compiler/testdata/noclone_serial.json
vendored
@@ -1,62 +1,154 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571811007",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571811007",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go build\"\ngo build\n\necho + \"go test\"\ngo test\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571811007",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571811007",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811007",
|
||||
"io.drone.expires": "1571814607",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "build",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQKCmVjaG8gKyAiZ28gdGVzdCIKZ28gdGVzdAo="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "build",
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811007",
|
||||
"io.drone.expires": "1571814607",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571811007",
|
||||
"io.drone.expires": "1571814607",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
82
engine/compiler/testdata/run_always.json
vendored
82
engine/compiler/testdata/run_always.json
vendored
@@ -1,63 +1,39 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {},
|
||||
"labels": {},
|
||||
"name": "build",
|
||||
"run_policy": "always",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQK"
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "build",
|
||||
"run_policy": 2,
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": {}
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {}
|
||||
}
|
||||
}
|
||||
82
engine/compiler/testdata/run_failure.json
vendored
82
engine/compiler/testdata/run_failure.json
vendored
@@ -1,63 +1,39 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {},
|
||||
"labels": {},
|
||||
"name": "build",
|
||||
"run_policy": "on-failure",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQK"
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"name": "build",
|
||||
"run_policy": 1,
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": { }
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {}
|
||||
}
|
||||
}
|
||||
412
engine/compiler/testdata/serial.json
vendored
412
engine/compiler/testdata/serial.json
vendored
@@ -1,104 +1,366 @@
|
||||
{
|
||||
"platform": {},
|
||||
"token": "3DA541559918A808C2402BBA5012F6C60B27661C",
|
||||
"server": {
|
||||
"name": "drone-temp-random",
|
||||
"image": "docker-18-04",
|
||||
"region": "nyc1",
|
||||
"size": "s-1vcpu-1gb",
|
||||
"user": "root"
|
||||
},
|
||||
"root": "/tmp/drone-random",
|
||||
"files": [
|
||||
{
|
||||
"path": "/tmp/drone-random/home",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/drone/src",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/opt",
|
||||
"mode": 448,
|
||||
"is_dir": true
|
||||
},
|
||||
{
|
||||
"path": "/tmp/drone-random/home/drone/.netrc",
|
||||
"mode": 384,
|
||||
"data": "bWFjaGluZSBnaXRodWIuY29tIGxvZ2luIG9jdG9jYXQgcGFzc3dvcmQgY29ycmVjdC1ob3JzZS1iYXR0ZXJ5LXN0YXBsZQ=="
|
||||
}
|
||||
],
|
||||
"steps": [
|
||||
{
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/clone"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"files": [
|
||||
"id": "random",
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571810939",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571810939",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571810939",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571810939",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"image": "drone/git:1",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810939",
|
||||
"io.drone.expires": "1571814539",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "clone",
|
||||
"run_policy": "always",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/clone",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnaXQgaW5pdCIKZ2l0IGluaXQKCmVjaG8gKyAiZ2l0IHJlbW90ZSBhZGQgb3JpZ2luICIKZ2l0IHJlbW90ZSBhZGQgb3JpZ2luIAoKZWNobyArICJnaXQgZmV0Y2ggIG9yaWdpbiArcmVmcy9oZWFkcy9tYXN0ZXI6IgpnaXQgZmV0Y2ggIG9yaWdpbiArcmVmcy9oZWFkcy9tYXN0ZXI6CgplY2hvICsgImdpdCBjaGVja291dCAgLWIgbWFzdGVyIgpnaXQgY2hlY2tvdXQgIC1iIG1hc3Rlcgo="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"secrets": [],
|
||||
"name": "clone",
|
||||
"run_policy": 2,
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
},
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/build"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"depends_on": [
|
||||
"clone"
|
||||
],
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571810939",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571810939",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go build\"\ngo build\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571810939",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571810939",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810939",
|
||||
"io.drone.expires": "1571814539",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "build",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/build",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyBidWlsZCIKZ28gYnVpbGQK"
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"secrets": [],
|
||||
"name": "build",
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
},
|
||||
{
|
||||
"id": "random",
|
||||
"args": [
|
||||
"-e",
|
||||
"/tmp/drone-random/opt/test"
|
||||
"echo \"$DRONE_SCRIPT\" | /bin/sh"
|
||||
],
|
||||
"command": "/bin/sh",
|
||||
"depends_on": [
|
||||
"build"
|
||||
],
|
||||
"files": [
|
||||
"entrypoint": [
|
||||
"/bin/sh",
|
||||
"-c"
|
||||
],
|
||||
"environment": {
|
||||
"CI": "true",
|
||||
"DRONE": "true",
|
||||
"DRONE_BRANCH": "master",
|
||||
"DRONE_BUILD_ACTION": "",
|
||||
"DRONE_BUILD_CREATED": "0",
|
||||
"DRONE_BUILD_EVENT": "",
|
||||
"DRONE_BUILD_FINISHED": "1571810939",
|
||||
"DRONE_BUILD_LINK": ":////0",
|
||||
"DRONE_BUILD_NUMBER": "0",
|
||||
"DRONE_BUILD_PARENT": "0",
|
||||
"DRONE_BUILD_STARTED": "1571810939",
|
||||
"DRONE_BUILD_STATUS": "success",
|
||||
"DRONE_COMMIT": "",
|
||||
"DRONE_COMMIT_AFTER": "",
|
||||
"DRONE_COMMIT_AUTHOR": "",
|
||||
"DRONE_COMMIT_AUTHOR_AVATAR": "",
|
||||
"DRONE_COMMIT_AUTHOR_EMAIL": "",
|
||||
"DRONE_COMMIT_AUTHOR_NAME": "",
|
||||
"DRONE_COMMIT_BEFORE": "",
|
||||
"DRONE_COMMIT_BRANCH": "master",
|
||||
"DRONE_COMMIT_LINK": "",
|
||||
"DRONE_COMMIT_MESSAGE": "",
|
||||
"DRONE_COMMIT_REF": "",
|
||||
"DRONE_COMMIT_SHA": "",
|
||||
"DRONE_DEPLOY_TO": "",
|
||||
"DRONE_DOCKER_NETWORK_ID": "random",
|
||||
"DRONE_DOCKER_VOLUME_ID": "random",
|
||||
"DRONE_GIT_HTTP_URL": "",
|
||||
"DRONE_GIT_SSH_URL": "",
|
||||
"DRONE_NETRC_FILE": "machine github.com login octocat password correct-horse-battery-staple",
|
||||
"DRONE_NETRC_MACHINE": "github.com",
|
||||
"DRONE_NETRC_PASSWORD": "correct-horse-battery-staple",
|
||||
"DRONE_NETRC_USERNAME": "octocat",
|
||||
"DRONE_REMOTE_URL": "",
|
||||
"DRONE_REPO": "",
|
||||
"DRONE_REPO_BRANCH": "",
|
||||
"DRONE_REPO_LINK": "",
|
||||
"DRONE_REPO_NAME": "",
|
||||
"DRONE_REPO_NAMESPACE": "",
|
||||
"DRONE_REPO_OWNER": "",
|
||||
"DRONE_REPO_PRIVATE": "false",
|
||||
"DRONE_REPO_SCM": "",
|
||||
"DRONE_REPO_VISIBILITY": "",
|
||||
"DRONE_SCRIPT": "\n\nif [ ! -z \"${DRONE_NETRC_FILE}\" ]; then\n\techo $DRONE_NETRC_FILE \u003e $HOME/.netrc\nfi\n\nunset DRONE_SCRIPT\nunset DRONE_NETRC_MACHINE\nunset DRONE_NETRC_USERNAME\nunset DRONE_NETRC_PASSWORD\nunset DRONE_NETRC_FILE\n\nset -e\n\n\necho + \"go test\"\ngo test\n",
|
||||
"DRONE_SOURCE_BRANCH": "",
|
||||
"DRONE_STAGE_ARCH": "",
|
||||
"DRONE_STAGE_DEPENDS_ON": "",
|
||||
"DRONE_STAGE_FINISHED": "1571810939",
|
||||
"DRONE_STAGE_KIND": "",
|
||||
"DRONE_STAGE_MACHINE": "",
|
||||
"DRONE_STAGE_NAME": "",
|
||||
"DRONE_STAGE_NUMBER": "0",
|
||||
"DRONE_STAGE_OS": "",
|
||||
"DRONE_STAGE_STARTED": "1571810939",
|
||||
"DRONE_STAGE_STATUS": "success",
|
||||
"DRONE_STAGE_TYPE": "",
|
||||
"DRONE_STAGE_VARIANT": "",
|
||||
"DRONE_SYSTEM_HOST": "",
|
||||
"DRONE_SYSTEM_HOSTNAME": "",
|
||||
"DRONE_SYSTEM_PROTO": "",
|
||||
"DRONE_SYSTEM_VERSION": "",
|
||||
"DRONE_TARGET_BRANCH": "master",
|
||||
"DRONE_WORKSPACE": "/drone/src",
|
||||
"DRONE_WORKSPACE_BASE": "/drone/src",
|
||||
"DRONE_WORKSPACE_PATH": "",
|
||||
"GIT_AUTHOR_EMAIL": "noreply@drone",
|
||||
"GIT_AUTHOR_NAME": "drone",
|
||||
"GIT_COMMITTER_EMAIL": "noreply@drone",
|
||||
"GIT_COMMITTER_NAME": "drone",
|
||||
"GIT_TERMINAL_PROMPT": "0"
|
||||
},
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810939",
|
||||
"io.drone.expires": "1571814539",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
},
|
||||
"name": "test",
|
||||
"volumes": [
|
||||
{
|
||||
"path": "/tmp/drone-random/opt/test",
|
||||
"mode": 448,
|
||||
"data": "CnNldCAtZQoKZWNobyArICJnbyB0ZXN0IgpnbyB0ZXN0Cg=="
|
||||
"name": "_workspace",
|
||||
"path": "/drone/src"
|
||||
}
|
||||
],
|
||||
"secrets": [],
|
||||
"name": "test",
|
||||
"working_dir": "/tmp/drone-random/drone/src"
|
||||
"working_dir": "/drone/src"
|
||||
}
|
||||
]
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"temp": {
|
||||
"id": "random",
|
||||
"name": "_workspace",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810939",
|
||||
"io.drone.expires": "1571814539",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"network": {
|
||||
"id": "random",
|
||||
"labels": {
|
||||
"io.drone": "true",
|
||||
"io.drone.build.number": "0",
|
||||
"io.drone.created": "1571810939",
|
||||
"io.drone.expires": "1571814539",
|
||||
"io.drone.protected": "false",
|
||||
"io.drone.repo.name": "",
|
||||
"io.drone.repo.namespace": "",
|
||||
"io.drone.repo.slug": "",
|
||||
"io.drone.stage.name": "",
|
||||
"io.drone.stage.number": "0",
|
||||
"io.drone.system.host": "",
|
||||
"io.drone.system.proto": "",
|
||||
"io.drone.system.version": "",
|
||||
"io.drone.ttl": "0s"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/drone-runners/drone-runner-docker/internal/docker/image"
|
||||
"github.com/drone-runners/drone-runner-docker/internal/docker/stdcopy"
|
||||
"github.com/drone/runner-go/registry/auths"
|
||||
|
||||
@@ -141,14 +142,6 @@ func (e *Docker) Run(ctx context.Context, spec *Spec, step *Step, output io.Writ
|
||||
//
|
||||
|
||||
func (e *Docker) create(ctx context.Context, spec *Spec, step *Step, output io.Writer) error {
|
||||
// parse the docker image name. We need to extract the
|
||||
// image domain name and match to registry credentials
|
||||
// stored in the .docker/config.json object.
|
||||
_, _, latest, err := parseImage(step.Image)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// create pull options with encoded authorization credentials.
|
||||
pullopts := types.ImagePullOptions{}
|
||||
if step.Auth != nil {
|
||||
@@ -161,7 +154,7 @@ func (e *Docker) create(ctx context.Context, spec *Spec, step *Step, output io.W
|
||||
// automatically pull the latest version of the image if requested
|
||||
// by the process configuration, or if the image is :latest
|
||||
if step.Pull == PullAlways ||
|
||||
(step.Pull == PullDefault && latest) {
|
||||
(step.Pull == PullDefault && image.IsLatest(step.Image)) {
|
||||
rc, pullerr := e.client.ImagePull(ctx, step.Image, pullopts)
|
||||
if pullerr == nil {
|
||||
io.Copy(ioutil.Discard, rc)
|
||||
@@ -172,7 +165,7 @@ func (e *Docker) create(ctx context.Context, spec *Spec, step *Step, output io.W
|
||||
}
|
||||
}
|
||||
|
||||
_, err = e.client.ContainerCreate(ctx,
|
||||
_, err := e.client.ContainerCreate(ctx,
|
||||
toConfig(spec, step),
|
||||
toHostConfig(spec, step),
|
||||
toNetConfig(spec, step),
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Polyform License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package engine
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/docker/distribution/reference"
|
||||
)
|
||||
|
||||
// helper function parses the image and returns the
|
||||
// canonical image name, domain name, and whether or not
|
||||
// the image tag is :latest.
|
||||
func parseImage(s string) (canonical, domain string, latest bool, err error) {
|
||||
// parse the docker image name. We need to extract the
|
||||
// image domain name and match to registry credentials
|
||||
// stored in the .docker/config.json object.
|
||||
named, err := reference.ParseNormalizedNamed(s)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// the canonical image name, for some reason, excludes
|
||||
// the tag name. So we need to make sure it is included
|
||||
// in the image name so we can determine if the :latest
|
||||
// tag is specified
|
||||
named = reference.TagNameOnly(named)
|
||||
|
||||
return named.String(),
|
||||
reference.Domain(named),
|
||||
strings.HasSuffix(named.String(), ":latest"),
|
||||
nil
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// Copyright 2019 Drone.IO Inc. All rights reserved.
|
||||
// Use of this source code is governed by the Polyform License
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
package engine
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseImage(t *testing.T) {
|
||||
tests := []struct {
|
||||
image string
|
||||
canonical string
|
||||
domain string
|
||||
latest bool
|
||||
err bool
|
||||
}{
|
||||
{
|
||||
image: "golang",
|
||||
canonical: "docker.io/library/golang:latest",
|
||||
domain: "docker.io",
|
||||
latest: true,
|
||||
},
|
||||
{
|
||||
image: "golang:1.11",
|
||||
canonical: "docker.io/library/golang:1.11",
|
||||
domain: "docker.io",
|
||||
latest: false,
|
||||
},
|
||||
{
|
||||
image: "",
|
||||
err: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
canonical, domain, latest, err := parseImage(test.image)
|
||||
if test.err {
|
||||
if err == nil {
|
||||
t.Errorf("Expect error parsing image %s", test.image)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if got, want := canonical, test.canonical; got != want {
|
||||
t.Errorf("Want image %s, got %s", want, got)
|
||||
}
|
||||
if got, want := domain, test.domain; got != want {
|
||||
t.Errorf("Want image domain %s, got %s", want, got)
|
||||
}
|
||||
if got, want := latest, test.latest; got != want {
|
||||
t.Errorf("Want image latest %v, got %v", want, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user