Skip to content

Commit

Permalink
Update to latest go-skel based build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud authored and yasker committed Sep 27, 2019
1 parent ba43bcd commit 7ed6bb2
Show file tree
Hide file tree
Showing 17 changed files with 351 additions and 138 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./.dapper
./.cache
./dist
221 changes: 221 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
---
kind: pipeline
name: amd64

platform:
os: linux
arch: amd64

steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock

- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-amd64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/local-path-provisioner"
tag: "${DRONE_TAG}-amd64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

volumes:
- name: docker
host:
path: /var/run/docker.sock

---
kind: pipeline
name: arm64

platform:
os: linux
arch: arm64

steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock

- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm64.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/local-path-provisioner"
tag: "${DRONE_TAG}-arm64"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

volumes:
- name: docker
host:
path: /var/run/docker.sock

---
kind: pipeline
name: arm

platform:
os: linux
arch: arm

steps:
- name: build
image: rancher/dapper:v0.4.1
commands:
- dapper ci
volumes:
- name: docker
path: /var/run/docker.sock

- name: github_binary_release
image: plugins/github-release
settings:
api_key:
from_secret: github_token
prerelease: true
checksum:
- sha256
checksum_file: CHECKSUMsum-arm.txt
checksum_flatten: true
files:
- "dist/artifacts/*"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

- name: docker-publish
image: plugins/docker
settings:
dockerfile: package/Dockerfile
password:
from_secret: docker_password
repo: "rancher/local-path-provisioner"
tag: "${DRONE_TAG}-arm"
username:
from_secret: docker_username
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

volumes:
- name: docker
host:
path: /var/run/docker.sock

---
kind: pipeline
name: manifest

platform:
os: linux
arch: amd64

steps:
- name: manifest
image: plugins/manifest:1.0.2
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
platforms:
- linux/amd64
- linux/arm64
- linux/arm
target: "rancher/local-path-provisioner:${DRONE_TAG}"
template: "rancher/local-path-provisioner:${DRONE_TAG}-ARCH"
when:
instance:
- drone-publish.rancher.io
ref:
- refs/head/master
- refs/tags/*
event:
- tag

depends_on:
- amd64
- arm64
- arm
22 changes: 6 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

*dapper*
!Dockerfile.dapper
bin/
/.dapper
/.cache
/bin
/dist
*.swp
.idea
19 changes: 19 additions & 0 deletions .golangci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"linters": {
"disable-all": true,
"enable": [
"govet",
"golint",
"goimports",
"misspell",
"ineffassign",
"gofmt"
]
},
"run": {
"skip-files": [
"/zz_generated_"
],
"deadline": "5m"
}
}
51 changes: 22 additions & 29 deletions Dockerfile.dapper
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
FROM ubuntu:16.04
# FROM arm=armhf/ubuntu:16.04

ARG DAPPER_HOST_ARCH=amd64
ARG http_proxy
ARG https_proxy
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}

RUN apt-get update && \
apt-get install -y gcc ca-certificates git wget curl vim less file python-tox python-dev && \
rm -f /bin/sh && ln -s /bin/bash /bin/sh

ENV DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.10.3 \
DOCKER_URL_arm=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm \
DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.10.3-ros1/docker-1.10.3_arm64 \
DOCKER_URL=DOCKER_URL_${ARCH}

RUN wget -O - ${!DOCKER_URL} > /usr/bin/docker && chmod +x /usr/bin/docker

ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm=armv6l GOLANG_ARCH_arm64=arm64 GOLANG_ARCH=GOLANG_ARCH_${ARCH} \
GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash

RUN wget -O - https://storage.googleapis.com/golang/go1.12.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local
RUN go get github.com/rancher/trash && go get golang.org/x/lint/golint

ENV DAPPER_SOURCE /go/src/github.com/rancher/local-path-provisioner
ENV DAPPER_OUTPUT ./bin
FROM golang:1.12.1-alpine3.9

ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH

RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates
RUN go get -d golang.org/x/lint/golint && \
git -C /go/src/golang.org/x/lint/golint checkout -b current 06c8688daad7faa9da5a0c2f163a3d14aac986ca && \
go install golang.org/x/lint/golint && \
rm -rf /go/src /go/pkg
RUN mkdir -p /go/src/golang.org/x && \
cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \
git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \
go install golang.org/x/tools/cmd/goimports
RUN rm -rf /go/src /go/pkg
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0; \
fi

ENV DAPPER_ENV REPO TAG DRONE_TAG
ENV DAPPER_SOURCE /go/src/github.com/rancher/local-path-provisioner/
ENV DAPPER_OUTPUT ./bin ./dist
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_ENV IMAGE REPO VERSION TAG
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}

Expand Down
26 changes: 1 addition & 25 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -174,28 +175,3 @@
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@ TARGETS := $(shell ls scripts)
$(TARGETS): .dapper
./.dapper $@

trash: .dapper
./.dapper -m bind trash

trash-keep: .dapper
./.dapper -m bind trash -k

deps: trash

.DEFAULT_GOAL := ci
.DEFAULT_GOAL := default

.PHONY: $(TARGETS)
8 changes: 3 additions & 5 deletions package/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
FROM alpine:latest

COPY bin /bin

ENTRYPOINT ["/bin/local-path-provisioner"]
FROM alpine
COPY bin/local-path-provisioner /usr/bin/
CMD ["local-path-provisioner"]
Loading

0 comments on commit 7ed6bb2

Please sign in to comment.