feat: Add new CI system
This commit is contained in:
parent
bc5e621683
commit
e12630ef06
19 changed files with 395 additions and 217 deletions
82
.github/workflows/build.yaml
vendored
Normal file
82
.github/workflows/build.yaml
vendored
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
name: Build Binaries
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GO_VERSION: 1.16
|
||||||
|
CGO_ENABLED: 0
|
||||||
|
PRE_TARGET: ""
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build-webui:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Build webui
|
||||||
|
run: |
|
||||||
|
make generate-webui
|
||||||
|
tar czvf webui.tar.gz ./static/
|
||||||
|
|
||||||
|
- name: Artifact webui
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: webui.tar.gz
|
||||||
|
path: webui.tar.gz
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-20.04, macos-latest, windows-latest ]
|
||||||
|
needs:
|
||||||
|
- build-webui
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ env.GO_VERSION }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: go/src/github.com/traefik/traefik
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
~/Library/Caches/go-build
|
||||||
|
'%LocalAppData%\go-build'
|
||||||
|
key: ${{ runner.os }}-build-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: ${{ runner.os }}-build-go-
|
||||||
|
|
||||||
|
- name: Installing dependencies
|
||||||
|
run: go install github.com/containous/go-bindata/go-bindata@v1.0.0
|
||||||
|
|
||||||
|
- name: Artifact webui
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: webui.tar.gz
|
||||||
|
path: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
||||||
|
|
||||||
|
- name: Untar webui
|
||||||
|
run: tar xvf webui.tar.gz
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make binary
|
5
.github/workflows/check_doc.yml
vendored
5
.github/workflows/check_doc.yml
vendored
|
@ -2,15 +2,16 @@ name: Check Documentation
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
name: Check, verify and build documentation
|
name: Check, verify and build documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
|
10
.github/workflows/documentation.yml
vendored
10
.github/workflows/documentation.yml
vendored
|
@ -6,18 +6,18 @@ on:
|
||||||
- master
|
- master
|
||||||
- v*
|
- v*
|
||||||
|
|
||||||
|
env:
|
||||||
|
STRUCTOR_VERSION: v1.11.2
|
||||||
|
MIXTUS_VERSION: v0.4.1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
name: Doc Process
|
name: Doc Process
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
if: github.repository == 'traefik/traefik'
|
if: github.repository == 'traefik/traefik'
|
||||||
env:
|
|
||||||
STRUCTOR_VERSION: v1.11.2
|
|
||||||
MIXTUS_VERSION: v0.4.1
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
|
46
.github/workflows/test-unit.yaml
vendored
Normal file
46
.github/workflows/test-unit.yaml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: Test Unit
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GO_VERSION: 1.16
|
||||||
|
PRE_TARGET: ""
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
test-unit:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ env.GO_VERSION }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: go/src/github.com/traefik/traefik
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
key: ${{ runner.os }}-test-unit-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: ${{ runner.os }}-test-unit-go-
|
||||||
|
|
||||||
|
- name: Installing dependencies
|
||||||
|
run: go install github.com/containous/go-bindata/go-bindata@v1.0.0
|
||||||
|
|
||||||
|
- name: Tests
|
||||||
|
run: make test-unit
|
100
.github/workflows/validate.yaml
vendored
Normal file
100
.github/workflows/validate.yaml
vendored
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
name: Validate
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
GO_VERSION: 1.16
|
||||||
|
GOLANGCI_LINT_VERSION: v1.41.1
|
||||||
|
MISSSPELL_VERSION: v0.3.4
|
||||||
|
PRE_TARGET: ""
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ env.GO_VERSION }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: go/src/github.com/traefik/traefik
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
key: ${{ runner.os }}-validate-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: ${{ runner.os }}-validate-go-
|
||||||
|
|
||||||
|
- name: Installing dependencies
|
||||||
|
run: go install github.com/containous/go-bindata/go-bindata@v1.0.0
|
||||||
|
|
||||||
|
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
|
||||||
|
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
|
||||||
|
|
||||||
|
- name: Install missspell ${{ env.MISSSPELL_VERSION }}
|
||||||
|
run: curl -sfL https://raw.githubusercontent.com/client9/misspell/master/install-misspell.sh | sh -s -- -b $(go env GOPATH)/bin ${MISSSPELL_VERSION}
|
||||||
|
|
||||||
|
- name: Validate
|
||||||
|
run: make validate
|
||||||
|
|
||||||
|
validate-generate:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ${{ github.workspace }}/go/src/github.com/traefik/traefik
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Set up Go ${{ env.GO_VERSION }}
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: go/src/github.com/traefik/traefik
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Go modules
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/go/pkg/mod
|
||||||
|
~/.cache/go-build
|
||||||
|
key: ${{ runner.os }}-validate-generate-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: ${{ runner.os }}-validate-generate-go-
|
||||||
|
|
||||||
|
- name: Installing dependencies
|
||||||
|
run: go install github.com/containous/go-bindata/go-bindata@v1.0.0
|
||||||
|
|
||||||
|
- name: go generate
|
||||||
|
run: |
|
||||||
|
go generate
|
||||||
|
git diff --exit-code
|
||||||
|
|
||||||
|
- name: go mod tidy
|
||||||
|
run: |
|
||||||
|
go mod tidy
|
||||||
|
git diff --exit-code
|
||||||
|
|
||||||
|
- name: make generate-crd
|
||||||
|
run: |
|
||||||
|
make generate-crd
|
||||||
|
git diff --exit-code
|
97
.semaphore/semaphore.yml
Normal file
97
.semaphore/semaphore.yml
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
version: v1.0
|
||||||
|
name: Traefik
|
||||||
|
agent:
|
||||||
|
machine:
|
||||||
|
type: e1-standard-4
|
||||||
|
os_image: ubuntu1804
|
||||||
|
|
||||||
|
fail_fast:
|
||||||
|
stop:
|
||||||
|
when: "branch != 'master'"
|
||||||
|
|
||||||
|
auto_cancel:
|
||||||
|
queued:
|
||||||
|
when: "branch != 'master'"
|
||||||
|
running:
|
||||||
|
when: "branch != 'master'"
|
||||||
|
|
||||||
|
global_job_config:
|
||||||
|
prologue:
|
||||||
|
commands:
|
||||||
|
- curl -sSfL https://raw.githubusercontent.com/ldez/semgo/master/godownloader.sh | sudo sh -s -- -b "/usr/local/bin"
|
||||||
|
- sudo semgo go1.16
|
||||||
|
- export "GOPATH=$(go env GOPATH)"
|
||||||
|
- export "SEMAPHORE_GIT_DIR=${GOPATH}/src/github.com/traefik/${SEMAPHORE_PROJECT_NAME}"
|
||||||
|
- export "PATH=${GOPATH}/bin:${PATH}"
|
||||||
|
- mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin"
|
||||||
|
- export GOPROXY=https://proxy.golang.org,direct
|
||||||
|
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.41.1
|
||||||
|
- curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | bash -s -- -b "${GOPATH}/bin"
|
||||||
|
- go install github.com/containous/go-bindata/go-bindata@v1.0.0
|
||||||
|
- checkout
|
||||||
|
- cache restore traefik-$(checksum go.sum)
|
||||||
|
|
||||||
|
blocks:
|
||||||
|
- name: Test Integration Container
|
||||||
|
dependencies: []
|
||||||
|
run:
|
||||||
|
when: "branch =~ '.*' OR pull_request =~'.*'"
|
||||||
|
task:
|
||||||
|
jobs:
|
||||||
|
- name: Test Integration Container
|
||||||
|
commands:
|
||||||
|
- make pull-images
|
||||||
|
- mkdir -p static # Avoid to generate webui
|
||||||
|
- PRE_TARGET="" make binary
|
||||||
|
- make test-integration-container
|
||||||
|
- df -h
|
||||||
|
epilogue:
|
||||||
|
always:
|
||||||
|
commands:
|
||||||
|
- cache store traefik-$(checksum go.sum) $HOME/go/pkg/mod
|
||||||
|
|
||||||
|
- name: Test Integration Host
|
||||||
|
dependencies: []
|
||||||
|
run:
|
||||||
|
when: "branch =~ '.*' OR pull_request =~'.*'"
|
||||||
|
task:
|
||||||
|
env_vars:
|
||||||
|
- name: PRE_TARGET
|
||||||
|
value: ""
|
||||||
|
jobs:
|
||||||
|
- name: Test Integration Host
|
||||||
|
commands:
|
||||||
|
- cache restore traefik-$(checksum go.sum)
|
||||||
|
- mkdir -p static # Avoid to generate webui
|
||||||
|
- make test-integration-host
|
||||||
|
epilogue:
|
||||||
|
always:
|
||||||
|
commands:
|
||||||
|
- cache store traefik-$(checksum go.sum) $HOME/go/pkg/mod
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
dependencies: []
|
||||||
|
run:
|
||||||
|
when: "tag =~ '.*'"
|
||||||
|
task:
|
||||||
|
secrets:
|
||||||
|
- name: traefik
|
||||||
|
env_vars:
|
||||||
|
- name: GH_VERSION
|
||||||
|
value: 1.12.1
|
||||||
|
- name: CODENAME
|
||||||
|
value: "livarot"
|
||||||
|
- name: PRE_TARGET
|
||||||
|
value: ""
|
||||||
|
prologue:
|
||||||
|
commands:
|
||||||
|
- export VERSION=${SEMAPHORE_GIT_TAG_NAME}
|
||||||
|
- curl -sSL -o /tmp/gh_${GH_VERSION}_linux_amd64.tar.gz https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz
|
||||||
|
- tar -zxvf /tmp/gh_${GH_VERSION}_linux_amd64.tar.gz -C /tmp
|
||||||
|
- sudo mv /tmp/gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh
|
||||||
|
jobs:
|
||||||
|
- name: Release
|
||||||
|
commands:
|
||||||
|
- make release-packages
|
||||||
|
- gh release create ${SEMAPHORE_GIT_TAG_NAME} ./dist/traefik*.* --repo traefik/traefik --title ${SEMAPHORE_GIT_TAG_NAME} --notes ${SEMAPHORE_GIT_TAG_NAME}
|
||||||
|
- ./script/deploy.sh
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
sudo rm -rf static
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
curl -O https://dl.google.com/go/go"${GO_VERSION}".linux-amd64.tar.gz
|
|
||||||
|
|
||||||
tar -xvf go"${GO_VERSION}".linux-amd64.tar.gz
|
|
||||||
rm -rf go"${GO_VERSION}".linux-amd64.tar.gz
|
|
||||||
|
|
||||||
sudo mkdir -p /usr/local/golang/"${GO_VERSION}"/go
|
|
||||||
sudo mv go /usr/local/golang/"${GO_VERSION}"/
|
|
||||||
|
|
||||||
sudo rm /usr/local/bin/go
|
|
||||||
sudo chmod +x /usr/local/golang/"${GO_VERSION}"/go/bin/go
|
|
||||||
sudo ln -s /usr/local/golang/"${GO_VERSION}"/go/bin/go /usr/local/bin/go
|
|
||||||
|
|
||||||
export GOROOT="/usr/local/golang/${GO_VERSION}/go"
|
|
||||||
export GOTOOLDIR="/usr/local/golang/${GO_VERSION}/go/pkg/tool/linux_amd64"
|
|
||||||
|
|
||||||
go version
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -n "$SHOULD_TEST" ]; then ci_retry make pull-images; fi
|
|
||||||
|
|
||||||
if [ -n "$SHOULD_TEST" ]; then ci_retry make test-integration; fi
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
ci_retry make validate
|
|
||||||
|
|
||||||
if [ -n "$SHOULD_TEST" ]; then ci_retry make test-unit; fi
|
|
||||||
|
|
||||||
if [ -n "$SHOULD_TEST" ]; then make -j"${N_MAKE_JOBS}" crossbinary-default-parallel; fi
|
|
|
@ -1,35 +0,0 @@
|
||||||
# For personnal CI
|
|
||||||
# mv /home/runner/workspace/src/github.com/<username>/ /home/runner/workspace/src/github.com/traefik/
|
|
||||||
# cd /home/runner/workspace/src/github.com/traefik/traefik/
|
|
||||||
for s in apache2 cassandra elasticsearch memcached mysql mongod postgresql sphinxsearch rethinkdb rabbitmq-server redis-server; do sudo service $s stop; done
|
|
||||||
sudo swapoff -a
|
|
||||||
sudo dd if=/dev/zero of=/swapfile bs=1M count=3072
|
|
||||||
sudo mkswap /swapfile
|
|
||||||
sudo swapon /swapfile
|
|
||||||
sudo rm -rf /home/runner/.rbenv
|
|
||||||
sudo rm -rf /usr/local/golang/{1.4.3,1.5.4,1.6.4,1.7.6,1.8.6,1.9.7,1.10.3,1.11}
|
|
||||||
#export DOCKER_VERSION=18.06.3
|
|
||||||
source .semaphoreci/vars
|
|
||||||
if [ -z "${PULL_REQUEST_NUMBER}" ]; then SHOULD_TEST="-*-"; else TEMP_STORAGE=$(curl --silent https://patch-diff.githubusercontent.com/raw/traefik/traefik/pull/${PULL_REQUEST_NUMBER}.diff | patch --dry-run -p1 -R || true); fi
|
|
||||||
echo ${SHOULD_TEST}
|
|
||||||
if [ -n "$TEMP_STORAGE" ]; then SHOULD_TEST=$(echo "$TEMP_STORAGE" | grep -Ev '(.md|.yaml|.yml)' || :); fi
|
|
||||||
echo ${TEMP_STORAGE}
|
|
||||||
echo ${SHOULD_TEST}
|
|
||||||
#if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq update; fi
|
|
||||||
#if [ -n "$SHOULD_TEST" ]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*; fi
|
|
||||||
if [ -n "$SHOULD_TEST" ]; then docker version; fi
|
|
||||||
export GO_VERSION=1.13
|
|
||||||
if [ -f "./go.mod" ]; then GO_VERSION="$(grep '^go .*' go.mod | awk '{print $2}')"; export GO_VERSION; fi
|
|
||||||
#if [ "${GO_VERSION}" == '1.15' ]; then export GO_VERSION=1.15rc2; fi
|
|
||||||
echo "Selected Go version: ${GO_VERSION}"
|
|
||||||
|
|
||||||
if [ -f "./.semaphoreci/golang.sh" ]; then ./.semaphoreci/golang.sh; fi
|
|
||||||
if [ -f "./.semaphoreci/golang.sh" ]; then export GOROOT="/usr/local/golang/${GO_VERSION}/go"; fi
|
|
||||||
if [ -f "./.semaphoreci/golang.sh" ]; then export GOTOOLDIR="/usr/local/golang/${GO_VERSION}/go/pkg/tool/linux_amd64"; fi
|
|
||||||
go version
|
|
||||||
|
|
||||||
if [ -f "./go.mod" ]; then export GO111MODULE=on; fi
|
|
||||||
if [ -f "./go.mod" ]; then export GOPROXY=https://proxy.golang.org; fi
|
|
||||||
if [ -f "./go.mod" ]; then go mod download; fi
|
|
||||||
|
|
||||||
df
|
|
|
@ -1,36 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
export REPO='traefik/traefik'
|
|
||||||
|
|
||||||
if VERSION=$(git describe --exact-match --abbrev=0 --tags);
|
|
||||||
then
|
|
||||||
export VERSION
|
|
||||||
else
|
|
||||||
export VERSION=''
|
|
||||||
fi
|
|
||||||
|
|
||||||
export CODENAME=livarot
|
|
||||||
|
|
||||||
export N_MAKE_JOBS=2
|
|
||||||
|
|
||||||
|
|
||||||
function ci_retry {
|
|
||||||
|
|
||||||
local NRETRY=3
|
|
||||||
local NSLEEP=5
|
|
||||||
local n=0
|
|
||||||
|
|
||||||
until [ $n -ge $NRETRY ]
|
|
||||||
do
|
|
||||||
"$@" && break
|
|
||||||
n=$((n+1))
|
|
||||||
echo "${*} failed, attempt ${n}/${NRETRY}"
|
|
||||||
sleep $NSLEEP
|
|
||||||
done
|
|
||||||
|
|
||||||
[ $n -lt $NRETRY ]
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export -f ci_retry
|
|
49
.travis.yml
49
.travis.yml
|
@ -1,49 +0,0 @@
|
||||||
sudo: required
|
|
||||||
dist: trusty
|
|
||||||
|
|
||||||
git:
|
|
||||||
depth: false
|
|
||||||
|
|
||||||
services:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- REPO=$TRAVIS_REPO_SLUG
|
|
||||||
- VERSION=$TRAVIS_TAG
|
|
||||||
- CODENAME=livarot
|
|
||||||
- GO111MODULE=on
|
|
||||||
|
|
||||||
script:
|
|
||||||
- echo "Skipping tests... (Tests are executed on SemaphoreCI)"
|
|
||||||
|
|
||||||
before_deploy:
|
|
||||||
- >
|
|
||||||
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
|
|
||||||
export BEFORE_DEPLOY_RUN=1;
|
|
||||||
sudo -E apt-get -yq update;
|
|
||||||
sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*;
|
|
||||||
docker version;
|
|
||||||
echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin;
|
|
||||||
make build-image;
|
|
||||||
if [ "$TRAVIS_TAG" ]; then
|
|
||||||
make release-packages;
|
|
||||||
fi;
|
|
||||||
fi
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
- provider: releases
|
|
||||||
api_key: ${GITHUB_TOKEN}
|
|
||||||
file: dist/traefik*
|
|
||||||
skip_cleanup: true
|
|
||||||
file_glob: true
|
|
||||||
on:
|
|
||||||
repo: traefik/traefik
|
|
||||||
tags: true
|
|
||||||
- provider: script
|
|
||||||
script: sh script/deploy.sh
|
|
||||||
skip_cleanup: true
|
|
||||||
on:
|
|
||||||
repo: traefik/traefik
|
|
||||||
tags: true
|
|
||||||
|
|
Binary file not shown.
24
Makefile
24
Makefile
|
@ -58,8 +58,9 @@ build-webui-image:
|
||||||
docker build -t traefik-webui --build-arg ARG_PLATFORM_URL=$(PLATFORM_URL) -f webui/Dockerfile webui
|
docker build -t traefik-webui --build-arg ARG_PLATFORM_URL=$(PLATFORM_URL) -f webui/Dockerfile webui
|
||||||
|
|
||||||
## Generate WebUI
|
## Generate WebUI
|
||||||
generate-webui: build-webui-image
|
generate-webui:
|
||||||
if [ ! -d "static" ]; then \
|
if [ ! -d "static" ]; then \
|
||||||
|
$(MAKE) build-webui-image; \
|
||||||
mkdir -p static; \
|
mkdir -p static; \
|
||||||
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui npm run build:nc; \
|
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui npm run build:nc; \
|
||||||
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui chown -R $(shell id -u):$(shell id -g) ../static; \
|
docker run --rm -v "$$PWD/static":'/src/static' traefik-webui chown -R $(shell id -u):$(shell id -g) ../static; \
|
||||||
|
@ -92,17 +93,16 @@ pull-images:
|
||||||
grep --no-filename -E '^\s+image:' ./integration/resources/compose/*.yml | awk '{print $$2}' | sort | uniq | xargs -P 6 -n 1 docker pull
|
grep --no-filename -E '^\s+image:' ./integration/resources/compose/*.yml | awk '{print $$2}' | sort | uniq | xargs -P 6 -n 1 docker pull
|
||||||
|
|
||||||
## Run the integration tests
|
## Run the integration tests
|
||||||
test-integration: $(PRE_TARGET)
|
test-integration: $(PRE_TARGET) binary
|
||||||
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK),TEST_CONTAINER=1) ./script/make.sh generate binary test-integration
|
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK),TEST_CONTAINER=1) ./script/make.sh test-integration
|
||||||
TEST_HOST=1 ./script/make.sh test-integration
|
TEST_HOST=1 ./script/make.sh test-integration
|
||||||
|
|
||||||
## Run the container integration tests
|
## Run the container integration tests
|
||||||
test-integration-container: $(PRE_TARGET)
|
test-integration-container: $(PRE_TARGET) binary
|
||||||
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK),TEST_CONTAINER=1) ./script/make.sh generate binary test-integration
|
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK),TEST_CONTAINER=1) ./script/make.sh test-integration
|
||||||
|
|
||||||
## Run the host integration tests
|
## Run the host integration tests
|
||||||
test-integration-host: $(PRE_TARGET)
|
test-integration-host: $(PRE_TARGET) binary
|
||||||
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK),TEST_CONTAINER=1) ./script/make.sh generate binary
|
|
||||||
TEST_HOST=1 ./script/make.sh test-integration
|
TEST_HOST=1 ./script/make.sh test-integration
|
||||||
|
|
||||||
## Validate code and docs
|
## Validate code and docs
|
||||||
|
@ -142,20 +142,20 @@ docs-pull-images:
|
||||||
|
|
||||||
## Generate CRD clientset
|
## Generate CRD clientset
|
||||||
generate-crd:
|
generate-crd:
|
||||||
./script/update-generated-crd-code.sh
|
@$(CURDIR)/script/code-gen.sh
|
||||||
|
|
||||||
## Create packages for the release
|
## Create packages for the release
|
||||||
release-packages: generate-webui build-dev-image
|
release-packages: generate-webui $(PRE_TARGET)
|
||||||
rm -rf dist
|
rm -rf dist
|
||||||
$(DOCKER_RUN_TRAEFIK_NOTTY) goreleaser release --skip-publish --timeout="60m"
|
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK_NOTTY)) goreleaser release --skip-publish --timeout="60m"
|
||||||
$(DOCKER_RUN_TRAEFIK_NOTTY) tar cfz dist/traefik-${VERSION}.src.tar.gz \
|
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK_NOTTY)) tar cfz dist/traefik-${VERSION}.src.tar.gz \
|
||||||
--exclude-vcs \
|
--exclude-vcs \
|
||||||
--exclude .idea \
|
--exclude .idea \
|
||||||
--exclude .travis \
|
--exclude .travis \
|
||||||
--exclude .semaphoreci \
|
--exclude .semaphoreci \
|
||||||
--exclude .github \
|
--exclude .github \
|
||||||
--exclude dist .
|
--exclude dist .
|
||||||
$(DOCKER_RUN_TRAEFIK_NOTTY) chown -R $(shell id -u):$(shell id -g) dist/
|
$(if $(PRE_TARGET),$(DOCKER_RUN_TRAEFIK_NOTTY)) chown -R $(shell id -u):$(shell id -g) dist/
|
||||||
|
|
||||||
## Format the Code
|
## Format the Code
|
||||||
fmt:
|
fmt:
|
||||||
|
|
24
script/code-gen.sh
Executable file
24
script/code-gen.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
PROJECT_MODULE="github.com/traefik/traefik"
|
||||||
|
MODULE_VERSION="v2"
|
||||||
|
IMAGE_NAME="kubernetes-codegen:latest"
|
||||||
|
|
||||||
|
echo "Building codegen Docker image..."
|
||||||
|
docker build --build-arg KUBE_VERSION=v0.20.2 --build-arg USER=$USER --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f "./script/codegen.Dockerfile" \
|
||||||
|
-t "${IMAGE_NAME}" \
|
||||||
|
"."
|
||||||
|
|
||||||
|
cmd="/go/src/k8s.io/code-generator/generate-groups.sh all ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd/generated ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd traefik:v1alpha1 --go-header-file=/go/src/${PROJECT_MODULE}/script/boilerplate.go.tmpl"
|
||||||
|
|
||||||
|
echo "Generating Traefik clientSet code ..."
|
||||||
|
echo $(pwd)
|
||||||
|
docker run --rm \
|
||||||
|
-v "$(pwd):/go/src/${PROJECT_MODULE}" \
|
||||||
|
-w "/go/src/${PROJECT_MODULE}" \
|
||||||
|
"${IMAGE_NAME}" $cmd
|
||||||
|
|
||||||
|
cp -r $(pwd)/${MODULE_VERSION}/* $(pwd)
|
||||||
|
rm -rf $(pwd)/${MODULE_VERSION}
|
19
script/codegen.Dockerfile
Normal file
19
script/codegen.Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
FROM golang:1.16
|
||||||
|
|
||||||
|
ARG USER=$USER
|
||||||
|
ARG UID=$UID
|
||||||
|
ARG GID=$GID
|
||||||
|
RUN useradd -m ${USER} --uid=${UID} && echo "${USER}:" chpasswd
|
||||||
|
USER ${UID}:${GID}
|
||||||
|
|
||||||
|
ARG KUBE_VERSION
|
||||||
|
|
||||||
|
RUN go get k8s.io/code-generator@$KUBE_VERSION; exit 0
|
||||||
|
RUN go get k8s.io/apimachinery@$KUBE_VERSION; exit 0
|
||||||
|
|
||||||
|
RUN mkdir -p $GOPATH/src/k8s.io/{code-generator,apimachinery}
|
||||||
|
RUN cp -R $GOPATH/pkg/mod/k8s.io/code-generator@$KUBE_VERSION $GOPATH/src/k8s.io/code-generator
|
||||||
|
RUN cp -R $GOPATH/pkg/mod/k8s.io/apimachinery@$KUBE_VERSION $GOPATH/src/k8s.io/apimachinery
|
||||||
|
RUN chmod +x $GOPATH/src/k8s.io/code-generator/generate-groups.sh
|
||||||
|
|
||||||
|
WORKDIR $GOPATH/src/k8s.io/code-generator
|
|
@ -1,33 +1,29 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -n "$TRAVIS_TAG" ]; then
|
if [ -n "${SEMAPHORE_GIT_TAG_NAME}" ]; then
|
||||||
echo "Deploying..."
|
echo "Deploying..."
|
||||||
else
|
else
|
||||||
echo "Skipping deploy"
|
echo "Skipping deploy"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git config --global user.email "$TRAEFIKER_EMAIL"
|
git config --global user.email "${TRAEFIKER_EMAIL}"
|
||||||
git config --global user.name "Traefiker"
|
git config --global user.name "Traefiker"
|
||||||
|
|
||||||
# load ssh key
|
# load ssh key
|
||||||
: "${encrypted_83c521e11abe_key:?}" # ensures variable is defined
|
|
||||||
: "${encrypted_83c521e11abe_iv:?}" # same
|
|
||||||
echo "Loading key..."
|
|
||||||
openssl aes-256-cbc -K "$encrypted_83c521e11abe_key" -iv "$encrypted_83c521e11abe_iv" -in .travis/traefiker_rsa.enc -out ~/.ssh/traefiker_rsa -d
|
|
||||||
eval "$(ssh-agent -s)"
|
eval "$(ssh-agent -s)"
|
||||||
chmod 600 ~/.ssh/traefiker_rsa
|
chmod 600 /home/semaphore/.ssh/traefiker_rsa
|
||||||
ssh-add ~/.ssh/traefiker_rsa
|
ssh-add /home/semaphore/.ssh/traefiker_rsa
|
||||||
|
|
||||||
# update traefik-library-image repo (official Docker image)
|
# update traefik-library-image repo (official Docker image)
|
||||||
echo "Updating traefik-library-imag repo..."
|
echo "Updating traefik-library-imag repo..."
|
||||||
git clone git@github.com:traefik/traefik-library-image.git
|
git clone git@github.com:traefik/traefik-library-image.git
|
||||||
cd traefik-library-image
|
cd traefik-library-image
|
||||||
./updatev2.sh "$VERSION"
|
./updatev2.sh "${VERSION}"
|
||||||
git add -A
|
git add -A
|
||||||
echo "$VERSION" | git commit --file -
|
echo "${VERSION}" | git commit --file -
|
||||||
echo "$VERSION" | git tag -a "$VERSION" --file -
|
echo "${VERSION}" | git tag -a "${VERSION}" --file -
|
||||||
git push -q --follow-tags -u origin master > /dev/null 2>&1
|
git push -q --follow-tags -u origin master > /dev/null 2>&1
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
HACK_DIR="$( cd "$( dirname "${0}" )" && pwd -P)"; export HACK_DIR
|
|
||||||
REPO_ROOT=${HACK_DIR}/..
|
|
||||||
TRAEFIK_MODULE_VERSION=v2
|
|
||||||
|
|
||||||
rm -rf "${REPO_ROOT}"/vendor
|
|
||||||
go mod vendor
|
|
||||||
chmod +x "${REPO_ROOT}"/vendor/k8s.io/code-generator/*.sh
|
|
||||||
|
|
||||||
"${REPO_ROOT}"/vendor/k8s.io/code-generator/generate-groups.sh \
|
|
||||||
all \
|
|
||||||
github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/provider/kubernetes/crd/generated \
|
|
||||||
github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/provider/kubernetes/crd \
|
|
||||||
traefik:v1alpha1 \
|
|
||||||
--go-header-file "${HACK_DIR}"/boilerplate.go.tmpl \
|
|
||||||
"$@"
|
|
||||||
|
|
||||||
deepcopy-gen \
|
|
||||||
--input-dirs github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/config/dynamic \
|
|
||||||
--input-dirs github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/tls \
|
|
||||||
--input-dirs github.com/traefik/traefik/${TRAEFIK_MODULE_VERSION}/pkg/types \
|
|
||||||
--output-package github.com/traefik/traefik \
|
|
||||||
-O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl
|
|
||||||
|
|
||||||
cp -r "${REPO_ROOT}"/"${TRAEFIK_MODULE_VERSION:?}"/* "${REPO_ROOT}"; rm -rf "${REPO_ROOT}"/"${TRAEFIK_MODULE_VERSION:?}"
|
|
||||||
|
|
||||||
rm -rf "${REPO_ROOT}"/vendor
|
|
Loading…
Reference in a new issue