(feat) initial commit

This commit is contained in:
TP Honey
2021-05-25 10:15:15 +01:00
parent b3176da391
commit fccb833868
6 changed files with 178 additions and 1 deletions
+14
View File
@@ -0,0 +1,14 @@
kind: pipeline
type: docker
name: default
- name: publish
image: plugins/docker
settings:
repo: tphoney/drone-diagnostics
auto_tag: true
dockerfile: docker/Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
+55
View File
@@ -0,0 +1,55 @@
# Blue Oak Model License
Version 1.0.0
## Purpose
This license gives everyone as much permission to work with
this software as possible, while protecting contributors
from liability.
## Acceptance
In order to receive this license, you must agree to its
rules. The rules of this license are both obligations
under that agreement and conditions to your license.
You must not do anything with this software that triggers
a rule that you cannot or will not follow.
## Copyright
Each contributor licenses you to do everything with this
software that would otherwise infringe that contributor's
copyright in it.
## Notices
You must ensure that everyone who gets a copy of
any part of this software from you, with or without
changes, also gets the text of this license or a link to
<https://blueoakcouncil.org/license/1.0.0>.
## Excuse
If anyone notifies you in writing that you have not
complied with [Notices](#notices), you can keep your
license by taking all practical steps to comply within 30
days after the notice. If you do not do so, your license
ends immediately.
## Patent
Each contributor licenses you to do everything with this
software that would otherwise infringe any patent claims
they can license or become able to license.
## Reliability
No contributor can revoke this license.
## No Liability
***As far as the law allows, this software comes as is,
without any warranty or condition, and no contributor
will be liable to anyone for any damages related to this
software or this license, under any kind of legal claim.***
+85 -1
View File
@@ -1 +1,85 @@
# drone-diagnostics
A plugin to cli tools to diagnose issues in a build.
# Usage
This plugin has a number of diagnosic tools installed, use the command syntax to access them.
Installed tools:
ping, tracroute
## Example 1
The below example skips the implicit clone step. Then displays the environment variables, then checks access to github. With ping and traceroute.
```yaml
kind: pipeline
name: default
clone:
disable: true
steps:
- name: run tphoney/drone-diagnostics plugin
image: tphoney/drone-diagnostics
pull: if-not-exists
commands:
- env
- ping www.github.com -w 5
- traceroute -T -p 443 www.github.com
- echo "end of test"
```
## Example 2
If the ftp upload fails, check connectivity to the ftp server. Useful for flakey networks.
```yaml
kind: pipeline
name: default
steps:
- name: upload to ftp server
image: alpine
commands:
- echo 'ftp rules' # perform some ftp commands
- name: run tphoney/drone-diagnostics plugin
image: tphoney/drone-diagnostics
pull: if-not-exists
commands:
- ping ftp.server
- echo "end of test"
when:
status:
- failure
```
Build the plugin image:
```text
docker build -t tphoney/drone-diagnostics -f docker/Dockerfile .
```
# Testing
Build the plugin image:
```text
docker build -t tphoney/drone-diagnostics -f docker/Dockerfile .
```
# Testing
Execute the plugin from your current working directory:
```text
docker run --rm -e PLUGIN_PARAM1=foo -e PLUGIN_PARAM2=bar \
-e DRONE_COMMIT_SHA=8f51ad7884c5eb69c11d260a31da7a745e6b78e2 \
-e DRONE_COMMIT_BRANCH=master \
-e DRONE_BUILD_NUMBER=43 \
-e DRONE_BUILD_STATUS=success \
-w /drone/src \
-v $(pwd):/drone/src \
tphoney/drone-diagnostics
```
+4
View File
@@ -0,0 +1,4 @@
FROM ubuntu
RUN apt-get update
RUN apt-get install -y traceroute iputils-ping
ENTRYPOINT /bin/bash
+10
View File
@@ -0,0 +1,10 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates
FROM alpine:3.6
ENV GODEBUG netdns=go
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ADD release/linux/arm/plugin /bin/
ENTRYPOINT ["/bin/plugin"]
+10
View File
@@ -0,0 +1,10 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates
FROM alpine:3.6
ENV GODEBUG netdns=go
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ADD release/linux/arm64/plugin /bin/
ENTRYPOINT ["/bin/plugin"]