diff --git a/.drone.jsonnet b/.drone.jsonnet deleted file mode 100644 index aa31430b..00000000 --- a/.drone.jsonnet +++ /dev/null @@ -1,113 +0,0 @@ -# defines the target version of Go. Please do not -# update this variable unless it has been previously -# approved on the mailing list. -local golang = "golang:1.11"; - -# defines a temporary volume so that the Go cache can -# be shared with all pipeline steps. -local volumes = [ - { - name: "gopath", - temp: {}, - }, -]; - -# defines the default Go cache location as a volume -# that is mounted into pipeline steps. -local mounts = [ - { - name: "gopath", - path: "/go", - }, -]; - -# defines a pipeline step that builds and publishes -# a docker image to a docker remote registry. -local docker(name, image, os, arch) = { - name: "publish_" + name, - image: "plugins/docker", - settings: { - repo: "drone/" + if name == "server" then "drone" else name, - auto_tag: true, - auto_tag_suffix: os + "-" + arch, - username: { from_secret: "docker_username" }, - password: { from_secret: "docker_password" }, - dockerfile: "docker/Dockerfile." + name + "." + os + "." + arch, - }, - when: { - event: [ "push", "tag" ], - }, -}; - -# defines a pipeline step that creates and publishes -# a docker manifest to a docker remote registry. -local manifest(name) = { - name: name, - image: "plugins/manifest", - settings: { - auto_tag: true, - ignore_missing: true, - spec: "docker/manifest." + name + ".tmpl", - username: { from_secret: "docker_username" }, - password: { from_secret: "docker_password" }, - }, - when: { - event: [ "push", "tag" ], - }, -}; - -# defines a pipeline that builds, tests and publishes -# docker images for the Drone agent, server and controller. -local pipeline(name, os, arch) = { - kind: "pipeline", - name: name, - volumes: volumes, - platform: { - os: os, - arch: arch, - }, - steps: [ - { - name: "test", - image: golang, - volumes: mounts, - commands: [ "go test -v ./..." ], - }, - { - name: "build", - image: golang, - volumes: mounts, - commands: [ - "go build -ldflags \"-extldflags \\\\\"-static\\\\\"\" -o release/"+ os +"/" + arch + "/drone-server github.com/drone/drone/cmd/drone-server", - "CGO_ENABLED=0 go build -o release/"+ os +"/" + arch + "/drone-agent github.com/drone/drone/cmd/drone-agent", - "CGO_ENABLED=0 go build -o release/"+ os +"/" + arch + "/drone-controller github.com/drone/drone/cmd/drone-controller", - ], - when: { - event: [ "push", "tag" ], - }, - }, - docker("agent", "agent", os, arch), - docker("controller", "controller", os, arch), - docker("server", "drone", os, arch), - ], -}; - -[ - pipeline("linux-amd64", "linux", "amd64"), - pipeline("linux-arm", "linux", "arm"), - pipeline("linux-arm64", "linux", "arm64"), - { - kind: "pipeline", - name: "manifest", - steps: [ - manifest("server"), - manifest("controller"), - manifest("agent"), - ], - depends_on: [ - "linux-amd64", - "linux-arm", - "linux-arm64", - ], - }, -] diff --git a/.drone.script b/.drone.script deleted file mode 100644 index 9c22a1f0..00000000 --- a/.drone.script +++ /dev/null @@ -1,152 +0,0 @@ -def main(ctx): - return [ - pipeline('linux-amd64', 'linux', 'amd64'), - pipeline('linux-arm64', 'linux', 'arm64'), - pipeline('linux-arm', 'linux', 'arm'), - pipeline_windows('1809'), - pipeline_windows('1903'), - manifest(), - ] - -# defines a pipeline step that builds and publishes a docker -# image to a docker remote registry. -def docker_step(name, os, arch): - repo = 'drone/%s' % name - if repo == 'server': - repo = 'drone/drone' - return { - 'name': 'publish_%s' % name, - 'image': 'plugins/docker:18', - 'settings': { - 'repo': repo, - 'auto_tag': True, - 'auto_tag_suffix': '%s-%s' % (os, arch), - 'username': { 'from_secret': 'docker_username' }, - 'password': { 'from_secret': 'docker_password' }, - 'dockerfile': 'docker/Dockerfile.%s.%s.%s' % (name, os, arch), - }, - 'when': { - 'event': [ 'push', 'tag' ], - }, - } - -# defines a pipeline step that executes the Go unit tests. -# this will also download dependencies and cache in /go -def test_step(): - return { - 'name': 'test', - 'image': 'golang:1.12', - 'commands': [ - 'go test ./...', - ], - } - -# defines a pipeline step that executes the Go unit tests. -# this will also download dependencies and cache in /go -def build_step(os, arch): - return { - 'name': 'build', - 'image': 'golang:1.12', - 'commands': [ - 'sh scripts/build.sh', - ], - 'environment': { - 'GOOS': os, - 'GOARCH': arch, - }, - } - -# defines a pipeline that builds, tests and publishes -# docker images for the Drone agent, server and controller. -def pipeline(name, os, arch): - return { - 'kind': 'pipeline', - 'type': 'docker', - 'name': 'linux-%s' % arch, - 'platform': { - 'os': 'linux', - 'arch': arch, - }, - 'steps': [ - test_step(), - build_step(os, arch), - docker_step('drone', os, arch), - docker_step('agent', os, arch), - docker_step('controller', os, arch), - ], - } - -# defines a pipeline that builds and publishes docker images -# for the Drone agent for the Windows kernel. -def pipeline_windows(version): - return { - 'kind': 'pipeline', - 'type': 'ssh', - 'name': 'windows-%s-amd64' % version, - 'platform': { 'os': 'windows' }, - 'server': { - 'host': { 'from_secret': 'windows_server_%s' % version }, - 'user': { 'from_secret': 'windows_username' }, - 'password': { 'from_secret': 'windows_password' }, - }, - 'steps': [ - { - 'name': 'build', - 'environment': { - 'USERNAME': { 'from_secret': 'docker_username' }, - 'PASSWORD': { 'from_secret': 'docker_password' }, - }, - # TODO these commands build and publish the latest - # docker tag regardless of git tag. - 'commands': [ - 'powershell.exe scripts/build.ps1', - 'docker login -u $env:USERNAME -p $env:PASSWORD', - 'docker build -f docker/Dockerfile.agent.windows.%s -t drone/agent:windows-%s-amd64 .' % (version, version), - 'docker push drone/agent:windows-%s-amd64' % version, - ], - }, - ], - 'trigger': { - 'event': ['push'] - } - } - -# defines a pipeline that updates the docker manifest -# for the architecture-specific images previously published -# to dockerhub. -def manifest(): - return { - 'kind': 'pipeline', - 'type': 'docker', - 'name': 'manifest', - 'steps': [ - manifest_step('server'), - manifest_step('agent'), - manifest_step('controller'), - ], - 'trigger': { - 'event': [ 'push', 'tag' ], - }, - 'depends_on': [ - 'linux-amd64', - 'linux-arm64', - 'linux-arm', - 'windows-1903-amd64', - 'windows-1809-amd64', - ], - } - -# defines a pipeline step that creates and publishes -# a docker manifest to a docker remote registry. -def manifest_step(name): - return { - 'name': 'publish_%s' % name, - 'image': 'plugins/manifest:1', - 'settings': { - 'auto_tag': True, - 'ignore_missing': True, - 'spec': 'docker/manifest.%s.tmpl' % name, - 'username': { 'from_secret': 'docker_username' }, - 'password': { 'from_secret': 'docker_password' }, - }, - }