diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..df364b5cc --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,95 @@ +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 + env: + DOCKER_RUN_TRAEFIK: "" + 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: ubuntu-20.04 + 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: Install gobindata + run: | + curl -fsSL -o $(go env GOPATH)/bin/go-bindata https://github.com/containous/go-bindata/releases/download/v1.0.0/go-bindata + chmod +x $(go env GOPATH)/bin/go-bindata + + - 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 for darwin + env: + DOCKER_RUN_TRAEFIK: "" + run: GOOS=darwin GOARCH=amd64 make binary + + - name: Build for linux + env: + DOCKER_RUN_TRAEFIK: "" + run: GOOS=linux GOARCH=amd64 make binary + + - name: Build for windows + env: + DOCKER_RUN_TRAEFIK: "" + run: GOOS=windows GOARCH=amd64 make binary diff --git a/.github/workflows/check_doc.yaml b/.github/workflows/check_doc.yaml new file mode 100644 index 000000000..95148dd5d --- /dev/null +++ b/.github/workflows/check_doc.yaml @@ -0,0 +1,21 @@ +name: Check Documentation + +on: + pull_request: + branches: + - '*' + +jobs: + + docs: + name: Check, verify and build documentation + runs-on: ubuntu-20.04 + + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Check documentation + run: make docs-verify diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml new file mode 100644 index 000000000..d7600a7b0 --- /dev/null +++ b/.github/workflows/documentation.yaml @@ -0,0 +1,52 @@ +name: Build and Publish Documentation + +on: + push: + branches: + - master + - v* + +env: + STRUCTOR_VERSION: v1.11.2 + MIXTUS_VERSION: v0.4.1 + +jobs: + + docs: + name: Doc Process + runs-on: ubuntu-20.04 + if: github.repository == 'traefik/traefik' + + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Install Structor ${{ env.STRUCTOR_VERSION }} + run: curl -sSfL https://raw.githubusercontent.com/traefik/structor/master/godownloader.sh | sh -s -- -b $HOME/bin ${STRUCTOR_VERSION} + + - name: Install Seo-doc + run: curl -sSfL https://raw.githubusercontent.com/traefik/seo-doc/master/godownloader.sh | sh -s -- -b "${HOME}/bin" + + - name: Install Mixtus ${{ env.MIXTUS_VERSION }} + run: curl -sSfL https://raw.githubusercontent.com/traefik/mixtus/master/godownloader.sh | sh -s -- -b $HOME/bin ${MIXTUS_VERSION} + + - name: Build documentation + run: $HOME/bin/structor -o traefik -r traefik --dockerfile-url="https://raw.githubusercontent.com/traefik/traefik/v1.7/docs.Dockerfile" --menu.js-url="https://raw.githubusercontent.com/traefik/structor/master/traefik-menu.js.gotmpl" --rqts-url="https://raw.githubusercontent.com/traefik/structor/master/requirements-override.txt" --force-edit-url --exp-branch=master --debug + env: + STRUCTOR_LATEST_TAG: ${{ secrets.STRUCTOR_LATEST_TAG }} + + - name: Apply seo + run: $HOME/bin/seo -path=./site + + - name: Publish documentation + run: $HOME/bin/mixtus --dst-doc-path="./traefik" --dst-owner=traefik --dst-repo-name=doc --git-user-email="30906710+traefiker@users.noreply.github.com" --git-user-name=traefiker --src-doc-path="./site" --src-owner=traefik --src-repo-name=traefik + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO }} diff --git a/.github/workflows/experimental.yaml b/.github/workflows/experimental.yaml new file mode 100644 index 000000000..2b002a484 --- /dev/null +++ b/.github/workflows/experimental.yaml @@ -0,0 +1,37 @@ +name: Build experimental image on branch + +on: + push: + branches: + - master + - v* + +jobs: + + experimental: + if: github.repository == 'traefik/traefik' + name: Build experimental image on branch + runs-on: ubuntu-20.04 + + steps: + + # https://github.com/marketplace/actions/checkout + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Branch name + run: echo ${GITHUB_REF##*/} + + - name: Build docker experimental image + run: docker build -t traefik/traefik:experimental-${GITHUB_REF##*/} -f exp.Dockerfile . + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Push to Docker Hub + run: docker push traefik/traefik:experimental-${GITHUB_REF##*/} diff --git a/.github/workflows/test-unit.yaml b/.github/workflows/test-unit.yaml new file mode 100644 index 000000000..890ebc523 --- /dev/null +++ b/.github/workflows/test-unit.yaml @@ -0,0 +1,53 @@ +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: Install gobindata + run: | + curl -fsSL -o $(go env GOPATH)/bin/go-bindata https://github.com/containous/go-bindata/releases/download/v1.0.0/go-bindata + chmod +x $(go env GOPATH)/bin/go-bindata + + - name: Avoid generating webui + run: mkdir -p webui/static && touch webui/static/index.html + + - name: Tests + env: + DOCKER_RUN_TRAEFIK: "" + run: make test-unit diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 000000000..73f2167bd --- /dev/null +++ b/.github/workflows/validate.yaml @@ -0,0 +1,102 @@ +name: Validate + +on: + pull_request: + branches: + - '*' + +env: + GO_VERSION: 1.16 + 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: Install golint + run: go install golang.org/x/lint/golint@latest + + - 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: Install gobindata + run: | + curl -fsSL -o $(go env GOPATH)/bin/go-bindata https://github.com/containous/go-bindata/releases/download/v1.0.0/go-bindata + chmod +x $(go env GOPATH)/bin/go-bindata + + - name: Avoid generating webui + run: mkdir -p webui/static && touch webui/static/index.html + + - name: Validate + env: + DOCKER_RUN_TRAEFIK: "" + 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: Install gobindata + run: | + curl -fsSL -o $(go env GOPATH)/bin/go-bindata https://github.com/containous/go-bindata/releases/download/v1.0.0/go-bindata + chmod +x $(go env GOPATH)/bin/go-bindata + + - name: go generate + run: | + go generate + git diff --exit-code + - name: go mod tidy + run: | + go mod tidy + git diff --exit-code diff --git a/.semaphore/semaphore.yml b/.semaphore/semaphore.yml new file mode 100644 index 000000000..fba855ba4 --- /dev/null +++ b/.semaphore/semaphore.yml @@ -0,0 +1,106 @@ +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 "GOROOT=$(go env GOROOT)" + - export "SEMAPHORE_GIT_DIR=${GOPATH}/src/github.com/traefik/${SEMAPHORE_PROJECT_NAME}" + - export "PATH=${GOPATH}/bin:${GOROOT}/bin:${PATH}" + - mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin" + - curl -fsSL -o ${GOPATH}/bin/go-bindata https://github.com/containous/go-bindata/releases/download/v1.0.0/go-bindata + - chmod +x ${GOPATH}/bin/go-bindata + - export GOPROXY=https://proxy.golang.org,direct + - checkout + - cache restore traefik-$(checksum go.sum) + +blocks: + - name: Test Integration Container + dependencies: [] + run: + when: "branch =~ '.*' OR pull_request =~'.*'" + task: + env_vars: + - name: DOCKER_RUN_TRAEFIK + value: "" + - name: TEST_CONTAINER + value: "1" + jobs: + - name: Test Integration Container + commands: + - make pull-images + - mkdir -p webui/static && touch webui/static/index.html # Avoid generating webui + - make binary-with-no-ui + - sudo CONTAINER=DOCKER DOCKER_RUN_TRAEFIK="" TEST_CONTAINER=1 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: DOCKER_RUN_TRAEFIK + value: "" + jobs: + - name: Test Integration Host + commands: + - mkdir -p webui/static && touch webui/static/index.html # Avoid generating webui + - make binary-with-no-ui + - sudo DOCKER_RUN_TRAEFIK="" TEST_HOST=1 make test-integration-host + epilogue: + always: + commands: + - cache store traefik-$(checksum go.sum) $HOME/go/pkg/mod + + - name: Release + dependencies: [] + run: + when: "tag =~ '.*'" + task: + agent: + machine: + type: e1-standard-8 + os_image: ubuntu1804 + secrets: + - name: traefik + env_vars: + - name: GH_VERSION + value: 1.12.1 + - name: CODENAME + value: "maroilles" + - name: DOCKER_RUN_TRAEFIK + 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 crossbinary-parallel + - 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 diff --git a/.semaphoreci/cleanup.sh b/.semaphoreci/cleanup.sh deleted file mode 100755 index bf92be1f9..000000000 --- a/.semaphoreci/cleanup.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -set -e - -sudo rm -rf static diff --git a/.semaphoreci/golang.sh b/.semaphoreci/golang.sh deleted file mode 100755 index 1cd7cf9c9..000000000 --- a/.semaphoreci/golang.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -e - -curl -O https://dl.google.com/go/go1.14.linux-amd64.tar.gz - -tar -xvf go1.14.linux-amd64.tar.gz -rm -rf go1.14.linux-amd64.tar.gz - -sudo mkdir -p /usr/local/golang/1.14/go -sudo mv go /usr/local/golang/1.14/ - -sudo rm /usr/local/bin/go -sudo chmod +x /usr/local/golang/1.14/go/bin/go -sudo ln -s /usr/local/golang/1.14/go/bin/go /usr/local/bin/go - -export GOROOT="/usr/local/golang/1.14/go" -export GOTOOLDIR="/usr/local/golang/1.14/go/pkg/tool/linux_amd64" - -go version diff --git a/.semaphoreci/job1.sh b/.semaphoreci/job1.sh deleted file mode 100755 index e8b806800..000000000 --- a/.semaphoreci/job1.sh +++ /dev/null @@ -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 diff --git a/.semaphoreci/job2.sh b/.semaphoreci/job2.sh deleted file mode 100755 index 68c21a281..000000000 --- a/.semaphoreci/job2.sh +++ /dev/null @@ -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 diff --git a/.semaphoreci/setup.sh b/.semaphoreci/setup.sh deleted file mode 100755 index f00ffdb61..000000000 --- a/.semaphoreci/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -set -e - -export DOCKER_VERSION=18.09.7 - -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); fi - -if [ -n "$TEMP_STORAGE" ]; then SHOULD_TEST=$(echo "$TEMP_STORAGE" | grep -Ev '(.md|.yaml|.yml)' || :); fi - -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 diff --git a/.semaphoreci/vars b/.semaphoreci/vars deleted file mode 100644 index 0b39987cf..000000000 --- a/.semaphoreci/vars +++ /dev/null @@ -1,37 +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=maroilles - -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 - diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c2afed1a9..000000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -sudo: required -dist: trusty - -git: - depth: false - -services: - - docker - -env: - global: - - REPO: $TRAVIS_REPO_SLUG - - VERSION: $TRAVIS_TAG - - CODENAME: maroilles - - N_MAKE_JOBS: 2 - - DOCS_VERIFY_SKIP: true - -script: -- echo "Skipping tests... (Tests are executed on SemaphoreCI)" -- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then make docs-verify; fi - -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 image; - if [ "$TRAVIS_TAG" ]; then - make -j${N_MAKE_JOBS} crossbinary-parallel; - tar cfz dist/traefik-${VERSION}.src.tar.gz --exclude-vcs --exclude dist .; - fi; - curl -sfL https://raw.githubusercontent.com/traefik/structor/master/godownloader.sh | bash -s -- -b "${GOPATH}/bin" ${STRUCTOR_VERSION} - curl -sSfL https://raw.githubusercontent.com/traefik/mixtus/master/godownloader.sh | sh -s -- -b "${GOPATH}/bin" ${MIXTUS_VERSION} - structor -o traefik -r traefik --dockerfile-url="https://raw.githubusercontent.com/traefik/traefik/v1.7/docs.Dockerfile" --menu.js-url="https://raw.githubusercontent.com/traefik/structor/master/traefik-menu.js.gotmpl" --rqts-url="https://raw.githubusercontent.com/traefik/structor/master/requirements-override.txt" --exp-branch=master --force-edit-url --debug; - 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 - - provider: script - script: mixtus --dst-doc-path="./traefik" --dst-owner=traefik --dst-repo-name=doc --git-user-email="30906710+traefiker@users.noreply.github.com" --git-user-name=traefiker --src-doc-path="./site" --src-owner=containous --src-repo-name=traefik - skip_cleanup: true - on: - repo: traefik/traefik - all_branches: true diff --git a/Makefile b/Makefile index 4cf20a718..e2d02b33d 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ DOCS_VERIFY_SKIP ?= false DOCKER_BUILD_ARGS := $(if $(DOCKER_VERSION), "--build-arg=DOCKER_VERSION=$(DOCKER_VERSION)",) DOCKER_RUN_OPTS := $(TRAEFIK_ENVS) $(TRAEFIK_MOUNT) "$(TRAEFIK_DEV_IMAGE)" -DOCKER_RUN_TRAEFIK := docker run $(INTEGRATION_OPTS) -it $(DOCKER_RUN_OPTS) +DOCKER_RUN_TRAEFIK ?= docker run $(INTEGRATION_OPTS) -it $(DOCKER_RUN_OPTS) DOCKER_RUN_TRAEFIK_NOTTY := docker run $(INTEGRATION_OPTS) -i $(DOCKER_RUN_OPTS) DOCKER_RUN_DOC_PORT := 8000 DOCKER_RUN_DOC_MOUNT := -v $(CURDIR):/mkdocs @@ -44,6 +44,9 @@ all: generate-webui build ## validate all checks, build linux binary, run all te binary: generate-webui build ## build the linux binary $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate binary +binary-with-no-ui: ## build the linux binary without the ui generation + $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate binary + crossbinary: generate-webui build ## cross build the non-linux binaries $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate crossbinary @@ -75,6 +78,12 @@ test-integration: build ## run the integration tests $(DOCKER_RUN_TRAEFIK) ./script/make.sh generate binary test-integration TEST_HOST=1 ./script/make.sh test-integration +test-integration-container: build ## Run the container integration tests + $(DOCKER_RUN_TRAEFIK) ./script/make.sh test-integration + +test-integration-host: build ## Run the host integration tests + TEST_HOST=1 ./script/make.sh test-integration + validate: build ## validate code, vendor and autogen $(DOCKER_RUN_TRAEFIK) ./script/make.sh validate-gofmt validate-golint validate-misspell validate-vendor validate-autogen diff --git a/docs.Dockerfile b/docs.Dockerfile index 946c26391..ee10a5302 100644 --- a/docs.Dockerfile +++ b/docs.Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.7 +FROM alpine:3.14 ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin @@ -6,5 +6,5 @@ COPY requirements.txt /mkdocs/ WORKDIR /mkdocs VOLUME /mkdocs -RUN apk --no-cache --no-progress add py-pip \ - && pip install --user -r requirements.txt +RUN apk --no-cache --no-progress add py3-pip gcc musl-dev python3-dev \ + && pip3 install --user -r requirements.txt diff --git a/docs/configuration/backends/docker.md b/docs/configuration/backends/docker.md index 2dfc96640..a26665bcf 100644 --- a/docs/configuration/backends/docker.md +++ b/docs/configuration/backends/docker.md @@ -196,7 +196,7 @@ by watching the Docker API through this socket. !!! important Depending on your context and your usage, accessing the Docker API without any restriction might be a security concern. -As explained on the Docker documentation: ([Docker Daemon Attack Surface page](https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface)): +As explained on the Docker documentation: ([Docker Daemon Attack Surface page](https://docs.docker.com/engine/security/#docker-daemon-attack-surface)): `[...] only **trusted** users should be allowed to control your Docker daemon [...]` @@ -209,7 +209,7 @@ to let Traefik accessing the Docker Socket of the Swarm manager node. More information about Docker's security: - [KubeCon EU 2018 Keynote, Running with Scissors, from Liz Rice](https://www.youtube.com/watch?v=ltrV-Qmh3oY) -- [Don't expose the Docker socket (not even to a container)](https://www.lvh.io/posts/dont-expose-the-docker-socket-not-even-to-a-container.html) +- [Don't expose the Docker socket (not even to a container)](https://www.lvh.io/posts/dont-expose-the-docker-socket-not-even-to-a-container/) - [A thread on Stack Overflow about sharing the `/var/run/docker.sock` file](https://news.ycombinator.com/item?id=17983623) - [To Dind or not to DinD](https://blog.loof.fr/2018/01/to-dind-or-not-do-dind.html) @@ -246,7 +246,7 @@ Use the following ressources to get started: ### Using Docker with Swarm Mode If you use a compose file with the Swarm mode, labels should be defined in the `deploy` part of your service. -This behavior is only enabled for docker-compose version 3+ ([Compose file reference](https://docs.docker.com/compose/compose-file/#labels-1)). +This behavior is only enabled for docker-compose version 3+ ([Compose file reference](https://docs.docker.com/compose/compose-file/compose-file-v3/#labels-2)). ```yaml version: "3" diff --git a/docs/user-guide/examples.md b/docs/user-guide/examples.md index f8977f618..fd8ea167b 100644 --- a/docs/user-guide/examples.md +++ b/docs/user-guide/examples.md @@ -373,7 +373,7 @@ Something more tricky using `regex`. In this case a slash is added to `siteexample.io/portainer` and redirect to `siteexample.io/portainer/`. For more details: https://github.com/traefik/traefik/issues/563 -The double sign `$$` are variables managed by the docker compose file ([documentation](https://docs.docker.com/compose/compose-file/#variable-substitution)). +The double sign `$$` are variables managed by the docker compose file ([documentation](https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution)). ``` portainer: diff --git a/integration/https_test.go b/integration/https_test.go index 42c7913d8..b294aa44e 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -66,7 +66,7 @@ func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) { defer cmd.Process.Kill() // wait for Traefik - err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains("Host:snitest.org")) + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 5*time.Second, try.BodyContains("Host:snitest.org")) c.Assert(err, checker.IsNil) backend1 := startTestServer("9010", http.StatusNoContent) @@ -74,9 +74,9 @@ func (s *HTTPSSuite) TestWithSNIConfigRoute(c *check.C) { defer backend1.Close() defer backend2.Close() - err = try.GetRequest(backend1.URL, 1*time.Second, try.StatusCodeIs(http.StatusNoContent)) + err = try.GetRequest(backend1.URL, 5*time.Second, try.StatusCodeIs(http.StatusNoContent)) c.Assert(err, checker.IsNil) - err = try.GetRequest(backend2.URL, 1*time.Second, try.StatusCodeIs(http.StatusResetContent)) + err = try.GetRequest(backend2.URL, 5*time.Second, try.StatusCodeIs(http.StatusResetContent)) c.Assert(err, checker.IsNil) tr1 := &http.Transport{ @@ -497,10 +497,10 @@ func (s *HTTPSSuite) TestWithRootCAsContentForHTTPSOnBackend(c *check.C) { defer cmd.Process.Kill() // wait for Traefik - err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains(backend.URL)) + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 5*time.Second, try.BodyContains(backend.URL)) c.Assert(err, checker.IsNil) - err = try.GetRequest("http://127.0.0.1:8081/ping", 1*time.Second, try.StatusCodeIs(http.StatusOK)) + err = try.GetRequest("http://127.0.0.1:8081/ping", 5*time.Second, try.StatusCodeIs(http.StatusOK)) c.Assert(err, checker.IsNil) } @@ -519,10 +519,10 @@ func (s *HTTPSSuite) TestWithRootCAsFileForHTTPSOnBackend(c *check.C) { defer cmd.Process.Kill() // wait for Traefik - err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains(backend.URL)) + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 5*time.Second, try.BodyContains(backend.URL)) c.Assert(err, checker.IsNil) - err = try.GetRequest("http://127.0.0.1:8081/ping", 1*time.Second, try.StatusCodeIs(http.StatusOK)) + err = try.GetRequest("http://127.0.0.1:8081/ping", 5*time.Second, try.StatusCodeIs(http.StatusOK)) c.Assert(err, checker.IsNil) } @@ -577,7 +577,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithNoChange(c *check.C) { } // wait for Traefik - err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains("Host:"+tr1.TLSClientConfig.ServerName)) + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 5*time.Second, try.BodyContains("Host:"+tr1.TLSClientConfig.ServerName)) c.Assert(err, checker.IsNil) backend1 := startTestServer("9010", http.StatusNoContent) @@ -646,7 +646,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithChange(c *check.C) { } // wait for Traefik - err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains("Host:"+tr2.TLSClientConfig.ServerName)) + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 5*time.Second, try.BodyContains("Host:"+tr2.TLSClientConfig.ServerName)) c.Assert(err, checker.IsNil) backend1 := startTestServer("9010", http.StatusNoContent) @@ -709,7 +709,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithTlsConfigurationDeletion(c } // wait for Traefik - err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains("Host:"+tr2.TLSClientConfig.ServerName)) + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 5*time.Second, try.BodyContains("Host:"+tr2.TLSClientConfig.ServerName)) c.Assert(err, checker.IsNil) backend2 := startTestServer("9020", http.StatusResetContent) diff --git a/script/deploy.sh b/script/deploy.sh index c748b467b..eb4f587e8 100755 --- a/script/deploy.sh +++ b/script/deploy.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -e -if [ -n "$TRAVIS_TAG" ]; then +if [ -n "$SEMAPHORE_GIT_TAG_NAME" ]; then echo "Deploying..." else echo "Skipping deploy" @@ -12,11 +12,9 @@ git config --global user.email "$TRAEFIKER_EMAIL" git config --global user.name "Traefiker" # load ssh key -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)" -chmod 600 ~/.ssh/traefiker_rsa -ssh-add ~/.ssh/traefiker_rsa +chmod 600 /home/semaphore/.ssh/traefiker_rsa +ssh-add /home/semaphore/.ssh/traefiker_rsa # update traefik-library-image repo (official Docker image) echo "Updating traefik-library-imag repo..." @@ -31,4 +29,4 @@ git push -q --follow-tags -u origin master > /dev/null 2>&1 cd .. rm -Rf traefik-library-image/ -echo "Deployed" \ No newline at end of file +echo "Deployed" diff --git a/script/docs-verify-docker-image/Dockerfile b/script/docs-verify-docker-image/Dockerfile index dcf387462..b76b4fc00 100644 --- a/script/docs-verify-docker-image/Dockerfile +++ b/script/docs-verify-docker-image/Dockerfile @@ -1,16 +1,37 @@ -FROM alpine:3.8 +FROM alpine:3.14 as alpine RUN apk --no-cache --no-progress add \ - ca-certificates \ - curl \ - findutils \ + libcurl \ + ruby \ ruby-bigdecimal \ ruby-etc \ ruby-ffi \ ruby-json \ - ruby-nokogiri=1.8.3-r0 \ - tini \ - && gem install --no-document html-proofer -v 3.9.3 + ruby-nokogiri \ + ruby-dev \ + build-base + +RUN gem install html-proofer --version 3.19.0 --no-document -- --use-system-libraries + +# After Ruby, some NodeJS YAY! +RUN apk --no-cache --no-progress add \ + git \ + nodejs \ + npm + +# To handle 'not get uid/gid' +RUN npm config set unsafe-perm true + +RUN npm install --global \ + markdownlint@0.22.0 \ + markdownlint-cli@0.26.0 + +# Finally the shell tools we need for later +# tini helps to terminate properly all the parallelized tasks when sending CTRL-C +RUN apk --no-cache --no-progress add \ + ca-certificates \ + curl \ + tini COPY ./validate.sh /validate.sh diff --git a/script/docs-verify-docker-image/validate.sh b/script/docs-verify-docker-image/validate.sh index 97d80a125..21b13464a 100644 --- a/script/docs-verify-docker-image/validate.sh +++ b/script/docs-verify-docker-image/validate.sh @@ -1,13 +1,13 @@ #!/bin/sh +PATH_TO_SITE="${1:-/app/site}" + set -eu -PATH_TO_SITE="/app/site" [ -d "${PATH_TO_SITE}" ] NUMBER_OF_CPUS="$(grep -c processor /proc/cpuinfo)" - echo "=== Checking HTML content..." # Search for all HTML files except the theme's partials @@ -19,10 +19,12 @@ find "${PATH_TO_SITE}" -type f -not -path "/app/site/theme/*" \ htmlproofer \ --check-html \ --check_external_hash \ + --empty_alt_ignore \ --alt_ignore="/traefikproxy-vertical-logo-color.svg/" \ --http_status_ignore="0,500,501,503" \ - --url-ignore "/https://groups.google.com/a/traefik.io/forum/#!forum/security/,/localhost:/,/127.0.0.1:/,/fonts.gstatic.com/,/.minikube/,/doc.traefik.io\/traefik/,/traefik.io/,/github.com\/traefik\/traefik\/*edit*/,/github.com\/traefik\/traefik\/$/" \ - '{}' + --file_ignore="/404.html/" \ + --url_ignore="/https://groups.google.com/a/traefik.io/forum/#!forum/security/,/localhost:/,/127.0.0.1:/,/fonts.gstatic.com/,/.minikube/,/github.com\/traefik\/traefik\/*edit*/,/github.com\/traefik\/traefik/,/doc.traefik.io/,/github\.com\/golang\/oauth2\/blob\/36a7019397c4c86cf59eeab3bc0d188bac444277\/.+/,/www.akamai.com/,/pilot.traefik.io\/profile/,/traefik.io/,/doc.traefik.io\/traefik-mesh/,/www.mkdocs.org/,/squidfunk.github.io/,/ietf.org/,/www.namesilo.com/,/www.youtube.com/,/www.linode.com/,/www.alibabacloud.com/" \ + '{}' 1>/dev/null ## HTML-proofer options at https://github.com/gjtorikian/html-proofer#configuration -echo "= Documentation checked successfuly." +echo "= Documentation checked successfully." diff --git a/webui/.gitignore b/webui/.gitignore index 82ef94631..ee0748c2c 100644 --- a/webui/.gitignore +++ b/webui/.gitignore @@ -5,6 +5,7 @@ /dist-server /tmp /out-tsc +/static/ # dependencies /node_modules