Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bradrydzewski committed Sep 17, 2020
0 parents commit 4876e76
Show file tree
Hide file tree
Showing 20 changed files with 581 additions and 0 deletions.
55 changes: 55 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Blue Oak Model License

Version 1.0.0

## Purpose

This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.

## Acceptance

In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.

## Copyright

Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.

## Notices

You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.

## Excuse

If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.

## Patent

Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.

## Reliability

No contributor can revoke this license.

## No Liability

***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# boilr-plugin

This is a [boilr template](https://github.com/tmrts/boilr) for creating a pipeline plugin. Use a pipeline plugin to create and share re-usable pipeline steps. Get started by installing the template:

```console
$ boilr download drone/boilr-plugin drone-plugin
```

create a project in directory my-plugin:

```console
$ boilr template use drone-plugin my-plugin
```

enter the docker registry name for this project:

```text
[?] Please choose a value for "DockerRepository" [default: "owner/name"]:
```

enter the go module name:

```text
[?] Please choose a value for "GoModule" [default: "github.com/owner/name":
```
5 changes: 5 additions & 0 deletions project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"DockerRepository": "owner/name",
"GoModule": "github.com/owner/name",
"Description": ""
}
21 changes: 21 additions & 0 deletions template/.drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
kind: pipeline
type: docker
name: default

steps:
- name: build
image: golang
commands:
- go build
- go test ./...

- name: publish
image: plugins/docker
settings:
repo: {{DockerRepository}}
auto_tag: true
dockerfile: docker/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
60 changes: 60 additions & 0 deletions template/.drone.yml.multiarch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# if you want to publish a multi-architecture image, replace the
# contents of the .drone.yml file with the contents of this file

kind: pipeline
type: docker
name: default

steps:
- name: build
image: golang
commands:
- go build
- go test ./...

- name: publish
image: plugins/docker
settings:
repo: {{DockerRepository}}
auto_tag: true
auto_tag_suffix: linux-amd64
dockerfile: docker/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password

- name: publish_arm
image: plugins/docker
settings:
repo: {{DockerRepository}}
auto_tag: true
auto_tag_suffix: linux-arm
dockerfile: docker/Dockerfile.linux.arm
username:
from_secret: docker_username
password:
from_secret: docker_password

- name: publish_arm
image: plugins/docker
settings:
repo: {{DockerRepository}}
auto_tag: true
auto_tag_suffix: linux-arm64
dockerfile: docker/Dockerfile.linux.arm64
username:
from_secret: docker_username
password:
from_secret: docker_password

- name: manifest
image: plugins/manifest
settings:
spec: docker/manifest.tmpl
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
username:
from_secret: docker_username
3 changes: 3 additions & 0 deletions template/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
release/

55 changes: 55 additions & 0 deletions template/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Blue Oak Model License

Version 1.0.0

## Purpose

This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.

## Acceptance

In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.

## Copyright

Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.

## Notices

You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.

## Excuse

If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.

## Patent

Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.

## Reliability

No contributor can revoke this license.

## No Liability

***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
30 changes: 30 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
A plugin to {{Description}}.

# Building

Build the plugin binary:

```text
scripts/build.sh
```

Build the plugin image:

```text
docker build -t {{DockerRepository}} -f docker/Dockerfile .
```

# Testing

Execute the plugin from your current working directory:

```text
docker run --rm \
-e DRONE_COMMIT_SHA=8f51ad7884c5eb69c11d260a31da7a745e6b78e2 \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_BUILD_NUMBER=43 \
-e DRONE_BUILD_STATUS=success \
-w /drone/src \
-v $(pwd):/drone/src \
{{DockerRepository}}
```
10 changes: 10 additions & 0 deletions template/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates

FROM alpine:3.6
ENV GODEBUG netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ADD release/linux/amd64/plugin /bin/
ENTRYPOINT ["/bin/plugin"]
10 changes: 10 additions & 0 deletions template/docker/Dockerfile.linux.arm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates

FROM alpine:3.6
ENV GODEBUG netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ADD release/linux/arm/plugin /bin/
ENTRYPOINT ["/bin/plugin"]
10 changes: 10 additions & 0 deletions template/docker/Dockerfile.linux.arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates

FROM alpine:3.6
ENV GODEBUG netdns=go

COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ADD release/linux/arm64/plugin /bin/
ENTRYPOINT ["/bin/plugin"]
31 changes: 31 additions & 0 deletions template/docker/manifest.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
image: {{DockerRepository}}:{{`{{#if build.tag}}`}}{{`{{trimPrefix "v" build.tag}}`}}{{`{{else}}`}}latest{{`{{/if}}`}}
{{`{{#if build.tags}}`}}
tags:
{{`{{#each build.tags}}`}}
- {{`{{this}}`}}
{{`{{/each}}`}}
{{`{{/if}}`}}
manifests:
-
image: {{DockerRepository}}:{{`{{#if build.tag}}`}}{{`{{trimPrefix "v" build.tag}}`}}-{{`{{/if}}`}}linux-amd64
platform:
architecture: amd64
os: linux
-
image: {{DockerRepository}}:{{`{{#if build.tag}}`}}{{`{{trimPrefix "v" build.tag}}`}}-{{`{{/if}}`}}linux-arm64
platform:
variant: v8
architecture: arm64
os: linux
-
image: {{DockerRepository}}:{{`{{#if build.tag}}`}}{{`{{trimPrefix "v" build.tag}}`}}-{{`{{/if}}`}}linux-arm
platform:
variant: v7
architecture: arm
os: linux
-
image: {{DockerRepository}}:{{`{{#if build.tag}}`}}{{`{{trimPrefix "v" build.tag}}`}}-{{`{{/if}}`}}linux-arm
platform:
variant: v6
architecture: arm
os: linux
8 changes: 8 additions & 0 deletions template/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module {{ GoModule }}

go 1.12

require (
github.com/kelseyhightower/envconfig v1.4.0
github.com/sirupsen/logrus v1.4.2
)
9 changes: 9 additions & 0 deletions template/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8=
github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Loading

0 comments on commit 4876e76

Please sign in to comment.