mirror of
https://github.com/gravitational/teleport
synced 2024-10-21 09:44:51 +00:00
98 lines
2.3 KiB
YAML
98 lines
2.3 KiB
YAML
---
|
|
kind: pipeline
|
|
type: kubernetes
|
|
name: test-and-build
|
|
|
|
trigger:
|
|
branch:
|
|
- master
|
|
- branch/*
|
|
event:
|
|
include:
|
|
- push
|
|
|
|
workspace:
|
|
path: /tmp
|
|
|
|
clone:
|
|
disable: true
|
|
|
|
steps:
|
|
- name: Check out code
|
|
image: docker:git
|
|
environment:
|
|
GITHUB_PRIVATE_KEY:
|
|
from_secret: GITHUB_PRIVATE_KEY
|
|
commands:
|
|
- mkdir -p /tmp/webassets
|
|
- cd /tmp/webassets
|
|
- 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
|
|
# check out submodules
|
|
- mkdir -m 0700 /root/.ssh && echo "$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 --recursive
|
|
- rm -f /root/.ssh/id_rsa
|
|
|
|
- name: Run tests
|
|
image: docker:git
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
commands:
|
|
# install make
|
|
- apk add --no-cache make
|
|
# run tests
|
|
- cd /tmp/webassets
|
|
- make clean test
|
|
|
|
- name: Build artifacts
|
|
image: docker:git
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
commands:
|
|
# install make
|
|
- apk add --no-cache make
|
|
# build artifacts
|
|
- cd /tmp/webassets
|
|
- make build
|
|
|
|
services:
|
|
- name: Start Docker
|
|
image: docker:dind
|
|
privileged: true
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run
|
|
|
|
volumes:
|
|
- name: dockersock
|
|
temp: {}
|
|
|
|
---
|
|
kind: signature
|
|
hmac: 11cc48c9df3830e257866c94bca190496d6a402941641553981ff6269b8667ab
|
|
|
|
...
|