forked from kubernetes/ingress-nginx
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#32 from ryansann/nginx-0.32.x-fix
Nginx 0.32.x fix
- Loading branch information
Showing
13 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
kind: pipeline | ||
name: ci | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
- name: build | ||
image: rancher/dapper:v0.4.1 | ||
commands: | ||
- dapper ci | ||
environment: | ||
GIT_IN_DAPPER: true | ||
volumes: | ||
- name: docker | ||
path: /var/run/docker.sock | ||
|
||
- name: publish | ||
image: docker | ||
commands: | ||
- docker login -u $USERNAME -p $PASSWORD | ||
- "docker tag rancher/nginx-ingress-controller-amd64:${DRONE_TAG} rancher/nginx-ingress-controller:${DRONE_TAG}-amd64" | ||
- "docker push rancher/nginx-ingress-controller:${DRONE_TAG}-amd64" | ||
- "docker tag rancher/nginx-ingress-controller-arm64:${DRONE_TAG} rancher/nginx-ingress-controller:${DRONE_TAG}-arm64" | ||
- "docker push rancher/nginx-ingress-controller:${DRONE_TAG}-arm64" | ||
environment: | ||
PASSWORD: | ||
from_secret: docker_password | ||
USERNAME: | ||
from_secret: docker_username | ||
volumes: | ||
- name: docker | ||
path: /var/run/docker.sock | ||
when: | ||
event: | ||
- tag | ||
instance: | ||
- drone-publish.rancher.io | ||
|
||
volumes: | ||
- name: docker | ||
host: | ||
path: /var/run/docker.sock | ||
|
||
node: | ||
docker_version: 19.03 | ||
|
||
--- | ||
kind: pipeline | ||
name: manifest | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
- name: push-manifest | ||
image: plugins/manifest:1.0.2 | ||
settings: | ||
password: | ||
from_secret: docker_password | ||
platforms: | ||
- linux/amd64 | ||
- linux/arm64 | ||
target: "rancher/nginx-ingress-controller:${DRONE_TAG}" | ||
template: "rancher/nginx-ingress-controller:${DRONE_TAG}-ARCH" | ||
username: | ||
from_secret: docker_username | ||
when: | ||
event: | ||
- tag | ||
instance: | ||
- drone-publish.rancher.io | ||
|
||
depends_on: | ||
- ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM docker:19.03.8 | ||
ARG DAPPER_HOST_ARCH | ||
ENV ARCH=${DAPPER_HOST_ARCH} | ||
RUN mkdir -p /.docker/cli-plugins | ||
RUN apk update && apk upgrade && apk add bash && ln -sf /bin/bash /bin/sh # use bash for subsequent variable expansion | ||
ENV DOCKER_BUILDX_URL_arm=https://github.com/docker/buildx/releases/download/v0.3.1/buildx-v0.3.1.linux-arm-v7 \ | ||
DOCKER_BUILDX_URL_arm64=https://github.com/docker/buildx/releases/download/v0.3.1/buildx-v0.3.1.linux-arm64 \ | ||
DOCKER_BUILDX_URL_amd64=https://github.com/docker/buildx/releases/download/v0.3.1/buildx-v0.3.1.linux-amd64 \ | ||
DOCKER_BUILDX_URL=DOCKER_BUILDX_URL_${ARCH} | ||
RUN wget -O - ${!DOCKER_BUILDX_URL} > /.docker/cli-plugins/docker-buildx && chmod +x /.docker/cli-plugins/docker-buildx | ||
|
||
FROM ubuntu:18.04 | ||
ARG DAPPER_HOST_ARCH | ||
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 zip make && \ | ||
rm -f /bin/sh && ln -s /bin/bash /bin/sh | ||
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://dl.google.com/go/go1.14.1.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local && \ | ||
go get github.com/rancher/trash && go get golang.org/x/lint/golint && go get -u github.com/jteeuwen/go-bindata/... | ||
COPY --from=0 /usr/local/bin/docker /usr/bin/docker | ||
RUN mkdir -p /.docker/cli-plugins | ||
COPY --from=0 /.docker/cli-plugins/docker-buildx /.docker/cli-plugins/docker-buildx | ||
ENV DOCKER_CLI_EXPERIMENTAL=enabled \ | ||
DOCKER_CONFIG=/.docker | ||
RUN docker buildx install | ||
ENV DAPPER_SOURCE /go/src/k8s.io/ingress-nginx/ | ||
ENV DAPPER_OUTPUT ./bin ./dist | ||
ENV DAPPER_DOCKER_SOCKET true | ||
ENV DAPPER_ENV CROSS TAG | ||
ENV DAPPER_RUN_ARGS="--net host" | ||
ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache | ||
ENV HOME ${DAPPER_SOURCE} | ||
ENV GIT_IN_DAPPER true | ||
RUN mkdir -p /etc/nginx/geoip | ||
WORKDIR ${DAPPER_SOURCE} | ||
ENTRYPOINT ["./scripts/entry"] | ||
CMD ["ci"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
TARGETS := $(shell ls scripts) | ||
|
||
.dapper: | ||
@echo Downloading dapper | ||
@curl -sL https://releases.rancher.com/dapper/latest/dapper-`uname -s`-`uname -m` > .dapper.tmp | ||
@@chmod +x .dapper.tmp | ||
@./.dapper.tmp -v | ||
@mv .dapper.tmp .dapper | ||
|
||
$(TARGETS): .dapper | ||
./.dapper $@ | ||
|
||
trash: .dapper | ||
./.dapper -m bind trash | ||
|
||
trash-keep: .dapper | ||
./.dapper -m bind trash -k | ||
|
||
deps: trash | ||
|
||
.DEFAULT_GOAL := ci | ||
|
||
.PHONY: $(TARGETS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
source $(dirname $0)/version | ||
|
||
cd $(dirname $0)/.. | ||
|
||
PKG="k8s.io/ingress-nginx" | ||
|
||
rm -rf bin/* | ||
mkdir -p bin | ||
|
||
declare -a arches=("arm64" "amd64") | ||
for arch in "${arches[@]}" | ||
do | ||
ARCH=$arch USE_DOCKER=false make build | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0) | ||
|
||
./validate | ||
./build | ||
./test | ||
./package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
mkdir -p bin dist | ||
if [ -e ./scripts/$1 ]; then | ||
./scripts/"$@" | ||
else | ||
exec "$@" | ||
fi | ||
|
||
chown -R $DAPPER_UID:$DAPPER_GID . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
REPO=${REPO:-rancher} | ||
|
||
source $(dirname $0)/version | ||
cd $(dirname $0)/.. | ||
|
||
for arch in $(ls bin); do | ||
REGISTRY=${REPO} ARCH=${arch} TAG=${TAG} make container | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
exec $(dirname $0)/ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0)/.. | ||
|
||
echo Running tests | ||
|
||
FIND_COMMAND="find" | ||
if [ "$(go env GOHOSTOS)" = "darwin" ]; then | ||
FIND_COMMAND="find ." | ||
fi | ||
|
||
PACKAGES="$($FIND_COMMAND -name '*.go' | xargs -I{} dirname {} | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin|docs|test|controller/store|images|examples|hack)')" | ||
|
||
go test -v -p 1 -tags "cgo" -cover ${PACKAGES} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd $(dirname $0)/.. | ||
|
||
echo Running validation | ||
|
||
PACKAGES="$(go list ./... | grep -v /vendor/)" | ||
|
||
echo Running: go vet | ||
go vet -mod=readonly ${PACKAGES} | ||
|
||
echo Running: go fmt | ||
test -z "$(go fmt -mod=readonly ${PACKAGES} | tee /dev/stderr)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
if [ "$GIT_IN_DAPPER" = true ]; then | ||
git config --global user.email "rancher-ci@rancher.com" | ||
git config --global user.name "rancher-ci" | ||
fi | ||
|
||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then | ||
DIRTY="-dirty" | ||
fi | ||
|
||
# fetch tag information | ||
git fetch | ||
|
||
GIT_COMMIT=${GIT_COMMIT:-$(git rev-parse --short HEAD)} | ||
GIT_TAG=$(git tag -l --contains HEAD | head -n 1) | ||
REPO_INFO=$(git config --get remote.origin.url) | ||
|
||
if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then | ||
VERSION=$GIT_TAG | ||
else | ||
VERSION="${GIT_COMMIT}${DIRTY}" | ||
fi | ||
|
||
if [ -z "$ARCH" ]; then | ||
ARCH=amd64 | ||
fi | ||
|
||
TAG=${TAG:-$VERSION} | ||
|
||
PKG="k8s.io/ingress-nginx" |