(maint) move to harness.drone.io (#48)
This commit is contained in:
parent
8070857203
commit
f03006262c
130
.drone.starlark
130
.drone.starlark
@ -1,130 +0,0 @@
|
||||
# this starlark script should be used to generate the .drone.yml
|
||||
# configuration file.
|
||||
|
||||
def main(ctx):
|
||||
# TODO consider running unit tests before building and
|
||||
# publishing docker images.
|
||||
before = {}
|
||||
|
||||
stages = [
|
||||
linux('arm'),
|
||||
linux('arm64'),
|
||||
linux('amd64'),
|
||||
windows('1903'),
|
||||
windows('1809'),
|
||||
]
|
||||
|
||||
after = manifest()
|
||||
|
||||
# the after stage should only execute after all previous
|
||||
# stages complete. this builds the dependency graph.
|
||||
for stage in stages:
|
||||
after['depends_on'].append(stage['name'])
|
||||
|
||||
return stages + [ after ]
|
||||
|
||||
# create a pipeline stage responsible for building and
|
||||
# publishing the Docker image on linux.
|
||||
def linux(arch):
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'linux-%s' % arch,
|
||||
'platform': {
|
||||
'os': 'linux',
|
||||
'arch': arch,
|
||||
},
|
||||
'steps': [
|
||||
{
|
||||
'name': 'build',
|
||||
'image': 'golang:1.10',
|
||||
'commands': [
|
||||
'cd posix',
|
||||
'tar -xf fixtures.tar -C /',
|
||||
'go test -v',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'publish',
|
||||
'image': 'plugins/docker',
|
||||
'settings': {
|
||||
'auto_tag': 'true',
|
||||
'auto_tag_suffix': 'linux-%s' % arch,
|
||||
'dockerfile': 'docker/Dockerfile.linux.%s' % arch,
|
||||
'password': {
|
||||
'from_secret': 'docker_password',
|
||||
},
|
||||
'repo': 'drone/git',
|
||||
'username': 'drone',
|
||||
},
|
||||
'when': {
|
||||
'event': ['push', 'tag']
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# create a pipeline stage responsible for building and
|
||||
# publishing the Docker image on windows. The windows stage
|
||||
# uses an ssh runner, as opposed to a docker runner.
|
||||
def 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': [
|
||||
'docker login -u $env:USERNAME -p $env:PASSWORD',
|
||||
'docker build -f docker/Dockerfile.windows.%s -t drone/git:windows-%s-amd64 .' % (version, version),
|
||||
'docker push drone/git:windows-%s-amd64' % version,
|
||||
],
|
||||
},
|
||||
],
|
||||
'trigger': {
|
||||
'event': ['push']
|
||||
}
|
||||
}
|
||||
|
||||
# create a pipeline stage responsible for creating and
|
||||
# publishing a docker manifest to the registry.
|
||||
def manifest():
|
||||
return {
|
||||
'kind': 'pipeline',
|
||||
'type': 'docker',
|
||||
'name': 'manifest',
|
||||
'steps': [
|
||||
{
|
||||
'name': 'manifest',
|
||||
'image': 'plugins/manifest',
|
||||
'settings': {
|
||||
'auto_tag': 'true',
|
||||
'username': 'drone',
|
||||
'password': {
|
||||
'from_secret': 'docker_password'
|
||||
},
|
||||
'spec': 'docker/manifest.tmpl',
|
||||
'ignore_missing': 'true',
|
||||
},
|
||||
},
|
||||
],
|
||||
'depends_on': [],
|
||||
'trigger': {
|
||||
'event': ['push', 'tag']
|
||||
}
|
||||
}
|
174
.drone.yml
174
.drone.yml
@ -1,23 +1,24 @@
|
||||
---
|
||||
# this file is automatically generated. DO NOT EDIT
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
type: vm
|
||||
name: linux-amd64
|
||||
|
||||
platform:
|
||||
arch: amd64
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
pool:
|
||||
use: ubuntu
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
- name: build
|
||||
image: golang:1.10
|
||||
commands:
|
||||
- cd posix
|
||||
- tar -xf fixtures.tar -C /
|
||||
- go test -v
|
||||
|
||||
- name: publish
|
||||
- name: publish
|
||||
image: plugins/docker:18
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.linux.amd64
|
||||
@ -35,22 +36,25 @@ steps:
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
type: vm
|
||||
name: linux-arm64
|
||||
|
||||
platform:
|
||||
arch: arm64
|
||||
os: linux
|
||||
arch: arm64
|
||||
|
||||
pool:
|
||||
use: ubuntu_arm64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
- name: build
|
||||
image: golang:1.10
|
||||
commands:
|
||||
- cd posix
|
||||
- tar -xf fixtures.tar -C /
|
||||
- go test -v
|
||||
|
||||
- name: publish
|
||||
- name: publish
|
||||
image: plugins/docker:18
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.linux.arm64
|
||||
@ -68,64 +72,30 @@ steps:
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: linux-arm
|
||||
type: vm
|
||||
name: windows-1809
|
||||
|
||||
platform:
|
||||
arch: arm
|
||||
os: linux
|
||||
os: windows
|
||||
arch: amd64
|
||||
|
||||
pool:
|
||||
use: windows
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: golang:1.10
|
||||
commands:
|
||||
- cd posix
|
||||
- tar -xf fixtures.tar -C /
|
||||
- go test -v
|
||||
|
||||
- name: publish
|
||||
image: plugins/docker:18
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.linux.arm
|
||||
repo: drone/git
|
||||
auto_tag: "true"
|
||||
auto_tag_suffix: linux-arm
|
||||
dockerfile: docker/Dockerfile.windows.1809
|
||||
repo: drone/git:windows-1809-amd64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
password:
|
||||
from_secret: docker_password
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- tag
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: windows-1909-amd64
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
|
||||
server:
|
||||
host:
|
||||
from_secret: windows_server_1909
|
||||
password:
|
||||
from_secret: windows_password
|
||||
user:
|
||||
from_secret: windows_username
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
commands:
|
||||
- docker login -u $env:USERNAME -p $env:PASSWORD
|
||||
- docker build -f docker/Dockerfile.windows.1909 -t drone/git:windows-1909-amd64 .
|
||||
- docker push drone/git:windows-1909-amd64
|
||||
environment:
|
||||
USERNAME:
|
||||
from_secret: docker_username
|
||||
PASSWORD:
|
||||
from_secret: docker_password
|
||||
auto_tag: true
|
||||
auto_tag_suffix: windows-1809-amd64
|
||||
daemon_off: true
|
||||
purge: false
|
||||
|
||||
trigger:
|
||||
event:
|
||||
@ -133,31 +103,30 @@ trigger:
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: windows-1903-amd64
|
||||
type: vm
|
||||
name: windows-ltsc2022
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
arch: amd64
|
||||
|
||||
server:
|
||||
host:
|
||||
from_secret: windows_server_1903
|
||||
password:
|
||||
from_secret: windows_password
|
||||
user:
|
||||
from_secret: windows_username
|
||||
pool:
|
||||
use: windows
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
commands:
|
||||
- docker login -u $env:USERNAME -p $env:PASSWORD
|
||||
- docker build -f docker/Dockerfile.windows.1903 -t drone/git:windows-1903-amd64 .
|
||||
- docker push drone/git:windows-1903-amd64
|
||||
environment:
|
||||
USERNAME:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
dockerfile: docker/Dockerfile.windows.ltsc2022
|
||||
repo: drone/git:windows-ltsc2022-amd64
|
||||
username:
|
||||
from_secret: docker_username
|
||||
PASSWORD:
|
||||
password:
|
||||
from_secret: docker_password
|
||||
auto_tag: true
|
||||
auto_tag_suffix: windows-ltsc2022-amd64
|
||||
daemon_off: true
|
||||
purge: false
|
||||
|
||||
trigger:
|
||||
event:
|
||||
@ -165,43 +134,18 @@ trigger:
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: windows-1809-amd64
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
|
||||
server:
|
||||
host:
|
||||
from_secret: windows_server_1809
|
||||
password:
|
||||
from_secret: windows_password
|
||||
user:
|
||||
from_secret: windows_username
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
commands:
|
||||
- docker login -u $env:USERNAME -p $env:PASSWORD
|
||||
- docker build -f docker/Dockerfile.windows.1809 -t drone/git:windows-1809-amd64 .
|
||||
- docker push drone/git:windows-1809-amd64
|
||||
environment:
|
||||
USERNAME:
|
||||
from_secret: docker_username
|
||||
PASSWORD:
|
||||
from_secret: docker_password
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
type: vm
|
||||
name: manifest
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
pool:
|
||||
use: ubuntu
|
||||
|
||||
steps:
|
||||
- name: manifest
|
||||
- name: manifest
|
||||
image: plugins/manifest
|
||||
settings:
|
||||
auto_tag: "true"
|
||||
@ -218,9 +162,7 @@ trigger:
|
||||
- tag
|
||||
|
||||
depends_on:
|
||||
- linux-amd64
|
||||
- linux-arm64
|
||||
- linux-arm
|
||||
- windows-1909-amd64
|
||||
- windows-1903-amd64
|
||||
- windows-1809-amd64
|
||||
- linux-amd64
|
||||
- linux-arm64
|
||||
- windows-1809
|
||||
- windows-ltsc2022
|
||||
|
@ -1,11 +0,0 @@
|
||||
FROM arm32v6/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
|
||||
# RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
# RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
# USER drone:drone
|
||||
# RUN chmod -R 777 /home/drone
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
@ -1,11 +0,0 @@
|
||||
FROM arm32v6/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
|
||||
# RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
# RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
# USER drone:drone
|
||||
# RUN chmod -R 777 /home/drone
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
@ -1,11 +0,0 @@
|
||||
FROM arm32v6/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
|
||||
# RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
# RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
# USER drone:drone
|
||||
# RUN chmod -R 777 /home/drone
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
@ -1,11 +0,0 @@
|
||||
FROM arm64v8/alpine:3.12
|
||||
RUN apk add --no-cache ca-certificates git git-lfs openssh curl perl aws-cli sudo
|
||||
|
||||
ADD posix/* /usr/local/bin/
|
||||
|
||||
# RUN adduser -g Drone -s /bin/sh -D -u 1000 drone
|
||||
# RUN echo 'drone ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/drone
|
||||
# USER drone:drone
|
||||
# RUN chmod -R 777 /home/drone
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/clone"]
|
@ -1,20 +0,0 @@
|
||||
# escape=`
|
||||
|
||||
FROM mcr.microsoft.com/windows/servercore:1903 AS git
|
||||
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/MinGit-2.21.0-64-bit.zip -OutFile git.zip; `
|
||||
Expand-Archive git.zip -DestinationPath C:\git;
|
||||
|
||||
FROM mcr.microsoft.com/powershell:nanoserver-1903
|
||||
COPY --from=git /git /git
|
||||
|
||||
ADD windows/* /bin/
|
||||
|
||||
# https://github.com/PowerShell/PowerShell/issues/6211#issuecomment-367477137
|
||||
USER ContainerAdministrator
|
||||
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell"
|
||||
|
||||
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
CMD [ "pwsh", "C:\\bin\\clone.ps1" ]
|
@ -1,20 +0,0 @@
|
||||
# escape=`
|
||||
|
||||
FROM mcr.microsoft.com/windows/servercore:1909 AS git
|
||||
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/MinGit-2.21.0-64-bit.zip -OutFile git.zip; `
|
||||
Expand-Archive git.zip -DestinationPath C:\git;
|
||||
|
||||
FROM mcr.microsoft.com/powershell:nanoserver-1909
|
||||
COPY --from=git /git /git
|
||||
|
||||
ADD windows/* /bin/
|
||||
|
||||
# https://github.com/PowerShell/PowerShell/issues/6211#issuecomment-367477137
|
||||
USER ContainerAdministrator
|
||||
RUN setx /M PATH "%PATH%;C:\Program Files\PowerShell"
|
||||
|
||||
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
CMD [ "pwsh", "C:\\bin\\clone.ps1" ]
|
@ -1,13 +1,13 @@
|
||||
# escape=`
|
||||
|
||||
FROM mcr.microsoft.com/windows/servercore:1803 AS git
|
||||
FROM mcr.microsoft.com/windows/servercore:ltsc2022 AS git
|
||||
SHELL ["powershell.exe", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; `
|
||||
Invoke-WebRequest -UseBasicParsing https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/MinGit-2.21.0-64-bit.zip -OutFile git.zip; `
|
||||
Expand-Archive git.zip -DestinationPath C:\git;
|
||||
|
||||
FROM mcr.microsoft.com/powershell:nanoserver-1803
|
||||
FROM mcr.microsoft.com/powershell:nanoserver-ltsc2022
|
||||
COPY --from=git /git /git
|
||||
|
||||
ADD windows/* /bin/
|
@ -17,24 +17,6 @@ manifests:
|
||||
variant: v8
|
||||
architecture: arm64
|
||||
os: linux
|
||||
-
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
platform:
|
||||
variant: v7
|
||||
architecture: arm
|
||||
os: linux
|
||||
-
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}linux-arm
|
||||
platform:
|
||||
variant: v6
|
||||
architecture: arm
|
||||
os: linux
|
||||
-
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1803-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
version: 1803
|
||||
-
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1809-amd64
|
||||
platform:
|
||||
@ -42,14 +24,8 @@ manifests:
|
||||
os: windows
|
||||
version: 1809
|
||||
-
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1903-amd64
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-ltsc2022-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
version: 1903
|
||||
-
|
||||
image: drone/git:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}windows-1909-amd64
|
||||
platform:
|
||||
architecture: amd64
|
||||
os: windows
|
||||
version: 1909
|
||||
version: ltsc2022
|
Loading…
Reference in New Issue
Block a user