Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable drone triggers #9313

Merged
merged 10 commits into from
Dec 10, 2021
347 changes: 1 addition & 346 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,348 +1,3 @@
---
################################################
# Generated using dronegen, do not edit by hand!
# Use 'make dronegen' to update.
# Generated at dronegen/tests.go:84
################################################

kind: pipeline
type: kubernetes
name: test
environment:
GID: "1000"
RUNTIME: go1.17.2
UID: "1000"
trigger:
event:
include:
- pull_request
repo:
include:
- gravitational/*
workspace:
path: /go
clone:
disable: true
steps:
- name: Check out code
image: docker:git
commands:
- mkdir -p /tmpfs/go/src/github.com/gravitational/teleport /tmpfs/go/cache
- cd /tmpfs/go/src/github.com/gravitational/teleport
- git init && git remote add origin ${DRONE_REMOTE_URL}
- |
# handle pull requests
if [ "${DRONE_BUILD_EVENT}" = "pull_request" ]; then
git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}:
git checkout ${DRONE_COMMIT_BRANCH}
git fetch origin ${DRONE_COMMIT_REF}:
git merge ${DRONE_COMMIT}
# handle tags
elif [ "${DRONE_BUILD_EVENT}" = "tag" ]; then
git fetch origin +refs/tags/${DRONE_TAG}:
git checkout -qf FETCH_HEAD
# handle pushes/other events
else
if [ "${DRONE_COMMIT_BRANCH}" = "" ]; then
git fetch origin
git checkout -qf ${DRONE_COMMIT_SHA}
else
git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}:
git checkout ${DRONE_COMMIT} -b ${DRONE_COMMIT_BRANCH}
fi
fi
- git submodule update --init webassets || true
- |
if [ "${DRONE_BUILD_EVENT}" = "pull_request" ]; then
apk add --no-cache curl jq
export PR_REPO=$(curl -Ls https://api.github.com/repos/gravitational/${DRONE_REPO_NAME}/pulls/${DRONE_PULL_REQUEST} | jq -r '.head.repo.full_name')
echo "---> Source repo for PR ${DRONE_PULL_REQUEST}: $${PR_REPO}"
# if the source repo for the PR matches DRONE_REPO, then this is not a PR raised from a fork
if [ "$${PR_REPO}" = "${DRONE_REPO}" ] || [ "${DRONE_REPO}" = "gravitational/teleport-private" ]; then
mkdir -m 0700 /root/.ssh && echo -n "$GITHUB_PRIVATE_KEY" > /root/.ssh/id_rsa && chmod 600 /root/.ssh/id_rsa
ssh-keyscan -H github.com > /root/.ssh/known_hosts 2>/dev/null && chmod 600 /root/.ssh/known_hosts
git submodule update --init e
# do a recursive submodule checkout to get both webassets and webassets/e
# this is allowed to fail because pre-4.3 Teleport versions don't use the webassets submodule
git submodule update --init --recursive webassets || true
rm -f /root/.ssh/id_rsa
fi
fi
environment:
GITHUB_PRIVATE_KEY:
from_secret: GITHUB_PRIVATE_KEY
volumes:
- name: tmpfs
path: /tmpfs
- name: Wait for docker
image: docker
commands:
- timeout 30s /bin/sh -c 'while [ ! -S /var/run/docker.sock ]; do sleep 1; done'
volumes:
- name: dockersock
path: /var/run
- name: Build buildbox
image: docker
commands:
- apk add --no-cache make
- chown -R $UID:$GID /tmpfs/go
- docker pull quay.io/gravitational/teleport-buildbox:$RUNTIME || true
- cd /tmpfs/go/src/github.com/gravitational/teleport
- make -C build.assets buildbox
volumes:
- name: tmpfs
path: /tmpfs
- name: dockersock
path: /var/run
- name: Run linter
image: docker
commands:
- apk add --no-cache make
- chown -R $UID:$GID /tmpfs/go
- cd /tmpfs/go/src/github.com/gravitational/teleport
- make -C build.assets lint
environment:
GOCACHE: /tmpfs/go/cache
GOPATH: /tmpfs/go
volumes:
- name: tmpfs
path: /tmpfs
- name: dockersock
path: /var/run
- name: Optionally skip tests
image: docker:git
commands:
- |
cd /tmpfs/go/src/github.com/gravitational/teleport
echo -e "\n---> git diff --raw ${DRONE_COMMIT}..origin/${DRONE_COMMIT_BRANCH:-master}\n"
git diff --raw ${DRONE_COMMIT}..origin/${DRONE_COMMIT_BRANCH:-master}
git diff --raw ${DRONE_COMMIT}..origin/${DRONE_COMMIT_BRANCH:-master} | awk '{print $6}' | grep -Ev '^docs/' | grep -Ev '.mdx$' | grep -Ev '.md$' | grep -v ^$ | wc -l > /tmp/.change_count.txt
export CHANGE_COUNT=$(cat /tmp/.change_count.txt | tr -d '\n')
echo -e "\n---> Non-docs changes detected: $$CHANGE_COUNT"
if [ $$CHANGE_COUNT -gt 0 ]; then
echo "---> Teleport tests will run normally"
else
echo "---> Skipping Teleport tests and exiting early"
exit 78
fi
echo ""
volumes:
- name: tmpfs
path: /tmpfs
- name: Run unit and chaos tests
image: docker
commands:
- apk add --no-cache make
- chown -R $UID:$GID /tmpfs/go
- cd /tmpfs/go/src/github.com/gravitational/teleport
- make -C build.assets test
environment:
GOCACHE: /tmpfs/go/cache
GOPATH: /tmpfs/go
volumes:
- name: tmpfs
path: /tmpfs
- name: dockersock
path: /var/run
- name: Run root-only integration tests
image: docker
commands:
- apk add --no-cache make
- cd /tmpfs/go/src/github.com/gravitational/teleport
- make -C build.assets integration-root
environment:
GOCACHE: /tmpfs/go/cache
GOPATH: /tmpfs/go
volumes:
- name: tmpfs
path: /tmpfs
- name: tmp-integration
path: /tmp
- name: dockersock
path: /var/run
- name: Run integration tests
image: docker
commands:
- apk add --no-cache make
- echo "$INTEGRATION_CI_KUBECONFIG" > "$KUBECONFIG"
- chown -R $UID:$GID /tmpfs/go
- cd /tmpfs/go/src/github.com/gravitational/teleport
- make -C build.assets integration
- rm -f "$KUBECONFIG"
environment:
GOCACHE: /tmpfs/go/cache
GOPATH: /tmpfs/go
INTEGRATION_CI_KUBECONFIG:
from_secret: INTEGRATION_CI_KUBECONFIG
KUBECONFIG: /tmpfs/go/kubeconfig.ci
TEST_KUBE: "true"
volumes:
- name: tmpfs
path: /tmpfs
- name: tmp-integration
path: /tmp
- name: dockersock
path: /var/run
services:
- name: Start Docker
image: docker:dind
privileged: true
volumes:
- name: tmpfs
path: /tmpfs
- name: dockertmpfs
path: /var/lib/docker
- name: tmp-integration
path: /tmp
- name: dockersock
path: /var/run
volumes:
- name: tmpfs
temp:
medium: memory
- name: tmp-integration
temp: {}
- name: dockertmpfs
temp: {}
- name: dockersock
temp: {}

---
################################################
# Generated using dronegen, do not edit by hand!
# Use 'make dronegen' to update.
# Generated at dronegen/tests.go:226
################################################

kind: pipeline
type: kubernetes
name: test-docs
trigger:
event:
include:
- pull_request
repo:
include:
- gravitational/*
workspace:
path: /go
clone:
disable: true
steps:
- name: Check out code
image: docker:git
commands:
- mkdir -p /tmpfs/go/src/github.com/gravitational/teleport /tmpfs/go/cache
- cd /tmpfs/go/src/github.com/gravitational/teleport
- git init && git remote add origin ${DRONE_REMOTE_URL}
- |
# handle pull requests
if [ "${DRONE_BUILD_EVENT}" = "pull_request" ]; then
git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}:
git checkout ${DRONE_COMMIT_BRANCH}
git fetch origin ${DRONE_COMMIT_REF}:
git merge ${DRONE_COMMIT}
# handle tags
elif [ "${DRONE_BUILD_EVENT}" = "tag" ]; then
git fetch origin +refs/tags/${DRONE_TAG}:
git checkout -qf FETCH_HEAD
# handle pushes/other events
else
if [ "${DRONE_COMMIT_BRANCH}" = "" ]; then
git fetch origin
git checkout -qf ${DRONE_COMMIT_SHA}
else
git fetch origin +refs/heads/${DRONE_COMMIT_BRANCH}:
git checkout ${DRONE_COMMIT} -b ${DRONE_COMMIT_BRANCH}
fi
fi
volumes:
- name: tmpfs
path: /tmpfs
- name: Wait for docker
image: docker
commands:
- timeout 30s /bin/sh -c 'while [ ! -S /var/run/docker.sock ]; do sleep 1; done'
volumes:
- name: dockersock
path: /var/run
- name: Run docs tests
image: docker:git
commands:
- apk add --no-cache make
- cd /tmpfs/go/src/github.com/gravitational/teleport
- chown -R $UID:$GID /tmpfs/go
- git diff --raw ${DRONE_COMMIT}..origin/${DRONE_COMMIT_BRANCH:-master} | awk '{print
$6}' | grep -E '^docs' | { grep -v ^$ || true; } > /tmp/docs-changes.txt
- |
if [ $(cat /tmp/docs-changes.txt | wc -l) -gt 0 ]; then
echo "---> Changes to docs detected"
cat /tmp/docs-changes.txt
echo "---> Checking for trailing whitespace"
make docs-test-whitespace
echo "---> Checking for dead links"
make -C build.assets test-docs
else
echo "---> No changes to docs detected, not running tests"
fi
environment:
GID: "1000"
GOCACHE: /tmpfs/go/cache
UID: "1000"
volumes:
- name: tmpfs
path: /tmpfs
- name: dockersock
path: /var/run
services:
- name: Start Docker
image: docker:dind
privileged: true
volumes:
- name: tmpfs
path: /tmpfs
- name: dockertmpfs
path: /var/lib/docker
- name: dockersock
path: /var/run
volumes:
- name: tmpfs
temp:
medium: memory
- name: dockertmpfs
temp: {}
- name: dockersock
temp: {}

---
kind: pipeline
type: kubernetes
name: update-docs-webhook

trigger:
event:
include:
- push
exclude:
- pull_request
branch:
include:
- master
- branch/*
repo:
include:
- gravitational/teleport

clone:
disable: true

steps:
- name: Trigger docs deployment
image: plugins/webhook
settings:
urls:
from_secret: DOCS_DEPLOY_HOOK

---
################################################
# Generated using dronegen, do not edit by hand!
Expand Down Expand Up @@ -4756,6 +4411,6 @@ volumes:
name: drone-s3-debrepo-pvc
---
kind: signature
hmac: 7fee7b17d306d1d41f8aebe49dc1db2700253e682e438cbc88c5153a8caaed34
hmac: 5049d1a961c95216d5131cd9ff35e3f234d74ada94a26dd57dcd8ee36598aeee

...
Loading