mirror of
https://github.com/k3s-io/k3s.git
synced 2024-06-07 19:41:36 +00:00
skip all pipelines based on what is in the PR (#6996)
* add droneignore, make trivial change to README for testing, updating drone config to use droneignore to skip CI when files are all matched Signed-off-by: matttrach <matttrach@gmail.com>
This commit is contained in:
parent
977a85559e
commit
8503d0143c
135
.drone.yml
135
.drone.yml
@ -7,6 +7,22 @@ platform:
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: skipfiles
|
||||
image: plugins/git
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
- name: build
|
||||
image: rancher/dapper:v0.5.0
|
||||
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader, unprivileged_github_token ]
|
||||
@ -179,6 +195,22 @@ platform:
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: skipfiles
|
||||
image: plugins/git
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
- name: build
|
||||
image: rancher/dapper:v0.5.0
|
||||
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
|
||||
@ -265,6 +297,22 @@ platform:
|
||||
arch: arm
|
||||
|
||||
steps:
|
||||
- name: skipfiles
|
||||
image: plugins/git
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
- name: build
|
||||
image: rancher/dapper:v0.5.0
|
||||
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
|
||||
@ -365,6 +413,22 @@ steps:
|
||||
- git fetch origin $DRONE_COMMIT_REF
|
||||
- git checkout $DRONE_COMMIT -b origin/$DRONE_TARGET_BRANCH
|
||||
|
||||
- name: skipfiles
|
||||
image: alpine/git:v2.30.2-s390x
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
- name: build
|
||||
image: rancher/dapper:v0.5.8
|
||||
secrets: [ AWS_SECRET_ACCESS_KEY-k3s-ci-uploader, AWS_ACCESS_KEY_ID-k3s-ci-uploader ]
|
||||
@ -455,19 +519,36 @@ platform:
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: validate_go_mods
|
||||
image: rancher/dapper:v0.5.0
|
||||
commands:
|
||||
- docker build --target test-mods -t k3s:mod -f Dockerfile.test .
|
||||
- docker run -i k3s:mod
|
||||
- name: skipfiles
|
||||
image: plugins/git
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
volumes:
|
||||
- name: docker
|
||||
path: /var/run/docker.sock
|
||||
volumes:
|
||||
- name: validate_go_mods
|
||||
image: rancher/dapper:v0.5.0
|
||||
commands:
|
||||
- docker build --target test-mods -t k3s:mod -f Dockerfile.test .
|
||||
- docker run -i k3s:mod
|
||||
|
||||
volumes:
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
path: /var/run/docker.sock
|
||||
|
||||
volumes:
|
||||
- name: docker
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@ -478,6 +559,22 @@ platform:
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: skipfiles
|
||||
image: plugins/git
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
- name: manifest
|
||||
image: plugins/docker
|
||||
environment:
|
||||
@ -518,6 +615,22 @@ platform:
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: skipfiles
|
||||
image: plugins/git
|
||||
commands:
|
||||
- export NAME=$(test $DRONE_BUILD_EVENT = pull_request && echo remotes/origin/${DRONE_COMMIT_BRANCH:-master} || echo ${DRONE_COMMIT_SHA}~)
|
||||
- export DIFF=$(git --no-pager diff --name-only $NAME | grep -v -f .droneignore);
|
||||
- if [ -z "$DIFF" ]; then
|
||||
echo "All files in PR are on ignore list";
|
||||
exit 78;
|
||||
else
|
||||
echo "Some files in PR are not ignored, $DIFF";
|
||||
fi;
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
|
||||
- name: dispatch
|
||||
image: curlimages/curl:7.74.0
|
||||
user: root
|
||||
|
9
.droneignore
Normal file
9
.droneignore
Normal file
@ -0,0 +1,9 @@
|
||||
^.*\.md$
|
||||
^install\.sh$
|
||||
^\.droneignore$
|
||||
^\.github/*$
|
||||
^MAINTAINERS$
|
||||
^CODEOWNERS$
|
||||
^LICENSE$
|
||||
^DCO$
|
||||
^channel\.yaml$
|
@ -160,4 +160,5 @@ Please check out our [contributing guide](CONTRIBUTING.md) if you're interested
|
||||
Security
|
||||
--------
|
||||
|
||||
Security issues in K3s can be reported by sending an email to [security@k3s.io](mailto:security@k3s.io). Please do not file issues about security issues.
|
||||
Security issues in K3s can be reported by sending an email to [security@k3s.io](mailto:security@k3s.io).
|
||||
Please do not file issues about security issues.
|
||||
|
Loading…
Reference in New Issue
Block a user