Compare commits

...

153 Commits
v2.0.1 ... main

Author SHA1 Message Date
dc9499494d
add deprecation notice 2023-08-29 21:37:10 +02:00
renovate[bot]
5b8ed49203 chore(docker): update golang:1.20 docker digest to 839ba88 2023-08-17 00:26:45 +00:00
renovate[bot]
1b81d9b309 chore(deps): update dependency golangci/golangci-lint to v1.54.1 2023-08-14 04:23:31 +00:00
renovate[bot]
ad0e5c20a7 chore(docker): update golang:1.20 docker digest to 37c7d85 2023-08-10 07:42:36 +00:00
renovate[bot]
6c3b703a75 chore(docker): update alpine:3.18 docker digest to 7144f7b 2023-08-08 00:04:36 +00:00
renovate[bot]
9c4cd6f4d8 chore(docker): update golang:1.20 docker digest to bc5f0b5 2023-08-02 03:04:15 +00:00
renovate[bot]
32fbf9a234 chore(docker): update golang:1.20 docker digest to 010a0ff 2023-07-30 01:13:29 +00:00
renovate[bot]
ae961b4cff chore(docker): update golang:1.20 docker digest to 3952625 2023-07-29 06:44:09 +00:00
renovate[bot]
0490fb3b83
fix(deps): update module github.com/urfave/cli/v2 to v2.25.7 (#140)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-19 09:54:49 +02:00
renovate[bot]
6ff0115c36
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.302 (#141)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-19 09:54:41 +02:00
renovate[bot]
29f45437b6 chore(docker): update golang:1.20 docker digest to cfc9d1b 2023-07-14 01:42:47 +00:00
renovate[bot]
22a176322a chore(docker): update golang:1.20 docker digest to 8e5a006 2023-07-12 00:33:32 +00:00
renovate[bot]
50fb140f66 chore(docker): update golang:1.20 docker digest to fd9306e 2023-07-06 04:46:20 +00:00
renovate[bot]
23e861b95f chore(docker): update golang:1.20 docker digest to 20ee7c8 2023-07-05 15:04:18 +00:00
renovate[bot]
98a0e95bfe chore(docker): update golang:1.20 docker digest to ff2cca5 2023-07-05 08:22:45 +00:00
renovate[bot]
91abeb92c8 chore(docker): update golang:1.20 docker digest to 7954299 2023-07-05 00:43:44 +00:00
renovate[bot]
997a6a16b5 chore(docker): update golang:1.20 docker digest to 344193a 2023-06-24 07:08:49 +00:00
renovate[bot]
e2ec69973b chore(docker): update golang:1.20 docker digest to 8f958bf 2023-06-22 13:30:37 +00:00
renovate[bot]
32ac157677 chore(docker): update golang:1.20 docker digest to 9d0422f 2023-06-22 08:21:26 +00:00
renovate[bot]
5f06938198
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.285 (#135)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-20 09:09:20 +02:00
renovate[bot]
7b855d26fd chore(deps): update dependency golangci/golangci-lint to v1.53.3 2023-06-19 04:23:09 +00:00
renovate[bot]
46f45b8494 chore(docker): update docker digests 2023-06-18 08:24:41 +00:00
renovate[bot]
97e5ae30e3 chore(docker): update golang:1.20 docker digest to e7bb4d1 2023-06-14 14:19:42 +00:00
renovate[bot]
25fd54bbcb chore(docker): update golang:1.20 docker digest to f28300f 2023-06-14 04:32:22 +00:00
renovate[bot]
89e06548b5
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.280 (#133)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-10 15:34:00 +02:00
renovate[bot]
ab492e5f01 chore(docker): update golang:1.20 docker digest to 4b1fc02 2023-06-07 02:04:12 +00:00
renovate[bot]
0027757cc6
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.3.4 (#132)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 14:08:26 +02:00
renovate[bot]
d93d5bf935
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.275 (#128)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 10:15:00 +02:00
renovate[bot]
769df02e4e
fix(deps): update module github.com/urfave/cli/v2 to v2.25.5 (#130)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 10:14:49 +02:00
renovate[bot]
24be32e9b8
fix(deps): update module github.com/sirupsen/logrus to v1.9.3 (#129)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-05 10:00:31 +02:00
renovate[bot]
5cb382dc18
chore(deps): update dependency golangci/golangci-lint to v1.53.2 (#131)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Robert Kaussow <mail@thegeeklab.de>
2023-06-05 09:54:56 +02:00
renovate[bot]
bc1574b319
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.3.3 (#127)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-29 13:08:05 +02:00
renovate[bot]
1ae37a2627
fix(deps): update module github.com/urfave/cli/v2 to v2.25.4 (#126)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-29 11:39:22 +02:00
renovate[bot]
37d3738266
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.271 (#115)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-28 23:09:47 +02:00
renovate[bot]
115764f40a
chore(deps): update alpine docker tag to v3.18 (#121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-28 15:27:41 +02:00
renovate[bot]
338ce66c98
fix(deps): update module github.com/sirupsen/logrus to v1.9.2 (#123)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-26 10:58:38 +02:00
renovate[bot]
26b6178a16 chore(docker): update golang:1.20 docker digest to 690e413 2023-05-24 08:10:55 +00:00
renovate[bot]
5c4da224c5 chore(docker): update golang:1.20 docker digest to 3f1f050 2023-05-24 02:10:03 +00:00
renovate[bot]
3bd9d1df75
fix(deps): update module github.com/urfave/cli/v2 to v2.25.3 (#120)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-05-13 11:15:28 +02:00
renovate[bot]
5b4a0b74ee chore(docker): update golang:1.20 docker digest to 685a22e 2023-05-10 06:31:51 +00:00
renovate[bot]
f39bb55202 chore(docker): update golang:1.20 docker digest to 31a8f92 2023-05-05 05:55:58 +00:00
renovate[bot]
cc8fed3fce chore(docker): update golang:1.20 docker digest to 4dd688d 2023-05-04 22:58:47 +00:00
renovate[bot]
cb03a3d203 chore(docker): update golang:1.20 docker digest to 6876eff 2023-05-04 03:39:41 +00:00
236085b2f0
fix bare url in contribution file (#117) 2023-05-03 11:51:16 +02:00
renovate[bot]
54b4ee8562
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.249 (#114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-25 09:52:13 +02:00
renovate[bot]
0940f4a5b5
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.3.2 (#113)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-14 23:26:51 +02:00
renovate[bot]
189386db93
fix(deps): update module github.com/urfave/cli/v2 to v2.25.1 (#110)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-14 08:53:32 +02:00
renovate[bot]
343b6e7234
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.243 (#108)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-14 08:49:06 +02:00
renovate[bot]
122c6a8c64 chore(docker): update golang:1.20 docker digest to 403f486 2023-04-13 12:48:48 +00:00
renovate[bot]
8330677c1c chore(docker): update golang:1.20 docker digest to b9709ec 2023-04-13 04:04:09 +00:00
renovate[bot]
4d88de0025 chore(deps): update golang devdeps non-major 2023-04-10 07:12:18 +00:00
renovate[bot]
0b1f2de73a
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.237 (#100)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-06 09:48:51 +02:00
renovate[bot]
c5d7f1fb9d chore(docker): update golang:1.20 docker digest to 23050c2 2023-04-05 09:18:42 +00:00
renovate[bot]
73b066bbc1 chore(docker): update alpine:3.17 docker digest to 124c7d2 2023-03-30 01:28:49 +00:00
renovate[bot]
d8603a6354 chore(docker): update golang:1.20 docker digest to f709934 2023-03-28 03:03:04 +00:00
renovate[bot]
88b40b546e chore(docker): update golang:1.20 docker digest to 1724dc3 2023-03-27 15:49:05 +00:00
renovate[bot]
3f6b05e178 chore(docker): update golang:1.20 docker digest to 80950aa 2023-03-24 06:37:30 +00:00
renovate[bot]
fb067ec1a0 chore(docker): update golang:1.20 docker digest to 8114f4a 2023-03-24 02:06:28 +00:00
renovate[bot]
3755380e29 chore(docker): update golang:1.20 docker digest to a13b5e3 2023-03-23 20:55:46 +00:00
renovate[bot]
ce55cbda96
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.224 (#97) 2023-03-20 09:36:34 +01:00
renovate[bot]
d744ce5174 chore(deps): update dependency golangci/golangci-lint to v1.52.0 2023-03-20 03:49:02 +00:00
renovate[bot]
c2efcd9335 chore(docker): update golang:1.20 docker digest to 5990c4f 2023-03-16 05:07:46 +00:00
renovate[bot]
2837e59a35 chore(docker): update alpine:3.17 docker digest to ff6bdca 2023-03-14 03:06:48 +00:00
renovate[bot]
509f35ee9d chore(docker): update golang:1.20 docker digest to 74a3829 2023-03-08 06:47:42 +00:00
renovate[bot]
4d4bf1db12 chore(docker): update golang:1.20 docker digest to 52921e6 2023-03-02 11:35:24 +00:00
renovate[bot]
f607610f44 chore(docker): update golang:1.20 docker digest to a83a6a3 2023-03-01 17:23:30 +00:00
renovate[bot]
3406d0d903
fix(deps): update module github.com/urfave/cli/v2 to v2.24.4 (#90) 2023-02-25 15:21:01 +01:00
renovate[bot]
e5f58105e6
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.209 (#89) 2023-02-25 15:07:43 +01:00
renovate[bot]
f45f5f02c7 chore(deps): update dependency golangci/golangci-lint to v1.51.2 2023-02-20 06:31:11 +00:00
renovate[bot]
e597746c33 chore(docker): update golang:1.20 docker digest to 2edf6aa 2023-02-16 10:16:39 +00:00
renovate[bot]
ebe1ce6eed chore(docker): update golang:1.20 docker digest to 9911e93 2023-02-15 06:49:28 +00:00
renovate[bot]
c063220478 chore(docker): update docker digests 2023-02-11 12:58:00 +00:00
renovate[bot]
b745b8daec chore(docker): update golang:1.20 docker digest to 53b7958 2023-02-10 12:40:57 +00:00
renovate[bot]
25b0714282 chore(docker): update golang:1.20 docker digest to 6e835db 2023-02-09 18:10:18 +00:00
2234e5d8f7
ci: bump container build plugin to drone-docker-buildx:23 (#81) 2023-02-09 08:54:22 +01:00
renovate[bot]
d147fea1c4
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.196 (#71) 2023-02-08 17:31:35 +01:00
renovate[bot]
559085f54c
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.3.1 (#79) 2023-02-08 17:19:10 +01:00
2aa7584420
fix drone-matrix template 2023-02-08 17:04:32 +01:00
renovate[bot]
b409f87689
fix(deps): update module github.com/joho/godotenv to v1.5.1 (#72) 2023-02-08 11:07:37 +01:00
renovate[bot]
c13939c820
chore(deps): update golang docker tag to v1.20 (#70) 2023-02-08 10:23:57 +01:00
d2730125d8
refactor: add more linters and fix findings (#78) 2023-02-08 10:14:25 +01:00
renovate[bot]
8f561ae1a0 chore(deps): update dependency golangci/golangci-lint to v1.51.1 2023-02-06 06:42:19 +00:00
renovate[bot]
2917bf9b57 chore(docker): update golang:1.19 docker digest to 09009d4 2023-02-05 15:11:53 +00:00
renovate[bot]
4d98876594 chore(docker): update golang:1.19 docker digest to 0ff9c06 2023-02-05 09:38:55 +00:00
renovate[bot]
a77ef85b99 chore(docker): update golang:1.19 docker digest to 101204a 2023-02-05 03:55:08 +00:00
renovate[bot]
b5e5d32d69 chore(docker): update golang:1.19 docker digest to 9e577b0 2023-02-04 14:56:06 +00:00
renovate[bot]
7b56fc2372
fix(deps): update module github.com/urfave/cli/v2 to v2.24.3 (#69) 2023-02-03 08:48:00 +01:00
renovate[bot]
c706deee99
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.192 (#68) 2023-02-02 08:51:06 +01:00
renovate[bot]
6cb88f2bba
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.181 (#67) 2023-01-18 13:27:28 +01:00
renovate[bot]
58ff92cf6e
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.180 (#63) 2023-01-15 21:52:55 +01:00
8e053365a1
ci: replace outdated gh-pages plugin (#66) 2023-01-14 23:21:18 +01:00
0c6065ef9b
unify makefile syntax (#65) 2023-01-14 22:59:30 +01:00
ed127a7689
refactor: use buildx for multiarch container builds (#64) 2023-01-14 22:45:25 +01:00
renovate[bot]
36641787c3 chore(docker): update docker digests 2023-01-09 23:36:42 +00:00
0203f9a488
ci: switch to buildx plugin (#61) 2023-01-08 15:44:58 +01:00
renovate[bot]
1ce872baa3
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.175 (#59) 2023-01-08 15:12:43 +01:00
8ddaf3cae3
BREAKING CHANGE: remove support for arm32 (#60) 2023-01-08 15:06:07 +01:00
renovate[bot]
840e51a455
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.2.1 (#58) 2022-12-21 08:45:02 +01:00
renovate[bot]
c8f1cb2881
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.164 (#57) 2022-12-20 21:25:29 +01:00
renovate[bot]
e96c268ec5
fix(deps): update module github.com/urfave/cli/v2 to v2.23.7 (#55) 2022-12-20 21:06:09 +01:00
renovate[bot]
ef6917b8ad
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.163 (#56) 2022-12-20 20:59:29 +01:00
renovate[bot]
14a615da87
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.157 (#54) 2022-12-11 14:23:28 +01:00
cb18954334
docs: fix properties file syntax due to changes in the theme (#53) 2022-11-24 15:09:36 +01:00
renovate[bot]
c3f804a396
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.145 (#44) 2022-11-24 10:33:09 +01:00
renovate[bot]
fd0bd077b7
fix(deps): update module github.com/urfave/cli/v2 to v2.23.5 (#45) 2022-11-24 10:32:59 +01:00
renovate[bot]
0507e9c9de
chore(deps): update alpine docker tag to v3.17 (#48) 2022-11-24 10:32:46 +01:00
renovate[bot]
e7c01b9cf9
chore(deps): update arm32v7/alpine docker tag to v3.17 (#49) 2022-11-24 10:32:39 +01:00
renovate[bot]
8029fc8826
chore(deps): update arm64v8/alpine docker tag to v3.17 (#50) 2022-11-24 10:32:30 +01:00
b9e3d0510f
ci: create symlink for xgo source directory (#52) 2022-11-24 09:44:02 +01:00
renovate[bot]
55646c984e chore(docker): update docker digests 2022-11-12 09:24:20 +00:00
renovate[bot]
d0f75ce6ae chore(docker): update docker digests 2022-11-11 02:03:02 +00:00
renovate[bot]
eebf29f6d5
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.127 (#36) 2022-11-01 14:03:36 +01:00
renovate[bot]
6b0fa142e0
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.2.0 (#43) 2022-10-31 19:59:25 +01:00
renovate[bot]
e0937f6aeb
fix(deps): update module github.com/urfave/cli/v2 to v2.23.0 (#38) 2022-10-31 12:43:49 +01:00
renovate[bot]
ae59991753 chore(deps): update dependency golangci/golangci-lint to v1.50.1 2022-10-24 05:00:24 +00:00
renovate[bot]
d0b9eb719e chore(deps): update dependency golangci/golangci-lint to v1.50.0 2022-10-10 03:54:04 +00:00
renovate[bot]
3bedd92358 chore(deps): update dependency mvdan/gofumpt to v0.4.0 2022-10-03 05:06:42 +00:00
renovate[bot]
cfad65b4a1 chore(deps): update dependency golangci/golangci-lint to v1.49.0 2022-08-29 04:25:58 +00:00
renovate[bot]
f050bd2ef5 chore(docker): update docker digests to bc41182 2022-08-09 23:00:46 +00:00
renovate[bot]
06567b89cb chore(deps): update dependency golangci/golangci-lint to v1.48.0 2022-08-08 03:21:29 +00:00
renovate[bot]
5f48b2ab14
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.1.0 (#34) 2022-08-05 16:56:24 +02:00
renovate[bot]
a6d48726c5
fix(deps): update module github.com/urfave/cli/v2 to v2.11.1 (#29) 2022-08-05 13:21:46 +02:00
renovate[bot]
f5caab1131
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.70 (#31) 2022-08-05 13:21:37 +02:00
836e382bdc
chore: switch to go1.19 (#33) 2022-08-05 13:18:54 +02:00
renovate[bot]
66850f34e0 chore(deps): update dependency golangci/golangci-lint to v1.47.2 2022-07-25 05:30:56 +00:00
renovate[bot]
889b8f8dd0
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.61 (#26) 2022-07-24 12:23:23 +02:00
renovate[bot]
018e7065c3
fix(deps): update module github.com/sirupsen/logrus to v1.9.0 (#28) 2022-07-21 09:56:47 +02:00
eb1f65e67c
fix worind in readme and adjust repo config 2022-07-21 09:48:00 +02:00
renovate[bot]
abbe255dc4 chore(docker): update docker digests to 7580ece 2022-07-19 00:33:18 +00:00
6b50ef38d3
ci: switch alpine-tools image 2022-07-17 20:45:27 +02:00
renovate[bot]
2fd1bca3c4
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.53 (#25) 2022-07-13 08:53:35 +02:00
renovate[bot]
8921dd4498
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.0.2 (#24) 2022-07-12 16:37:26 +02:00
renovate[bot]
3c5829c2ca
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.52 (#23) 2022-07-12 09:14:02 +02:00
ffe26e8540
docs: fix spelling in readme 2022-07-12 09:12:37 +02:00
renovate[bot]
478182371c
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.51 (#21) 2022-07-11 08:52:01 +02:00
renovate[bot]
8cbc38ada5
fix(deps): update module github.com/urfave/cli/v2 to v2.11.0 (#22) 2022-07-11 08:51:22 +02:00
renovate[bot]
d17f682ce7
fix(deps): update module github.com/thegeeklab/drone-plugin-lib/v2 to v2.0.1 (#20) 2022-06-20 21:04:04 +02:00
renovate[bot]
7fd5ede350
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.37 (#15) 2022-06-20 10:26:33 +02:00
renovate[bot]
3d84db568b
fix(deps): update module github.com/urfave/cli/v2 to v2.10.1 (#19) 2022-06-20 10:26:22 +02:00
df7cc521d1
refactor: rename parameter access to acl (#18)
BREAKING CHANGE: The parameter `access` was renamed to `acl` and the environment variable `PLUGIN_ACCESS` was removed.
2022-05-29 22:36:25 +02:00
9e053ce454
adjust wording of the help texts 2022-05-29 22:29:36 +02:00
5207ccc664
fix(deps): update module github.com/thegeeklab/drone-plugin-lib to v2 2022-05-29 13:56:55 +02:00
2c1fe02de9
refactor: add plugin flags to category (#16) 2022-05-29 12:37:09 +02:00
46cf242810
docs: add usage examples 2022-05-26 17:49:28 +02:00
c352a24dbd
simplify docs folder structure 2022-05-26 15:53:35 +02:00
renovate[bot]
2f1f11922c
fix(deps): update module github.com/aws/aws-sdk-go to v1.44.20 (#9) 2022-05-24 09:12:40 +02:00
renovate[bot]
c5a5f13534
fix(deps): update module github.com/urfave/cli/v2 to v2.8.0 (#11) 2022-05-24 08:55:51 +02:00
renovate[bot]
6f0af11f5f
chore(deps): update dependency alpine to v3.16 (#12) 2022-05-24 08:55:44 +02:00
renovate[bot]
cd7fac86f3
chore(deps): update dependency arm32v7/alpine to v3.16 (#13) 2022-05-24 08:55:36 +02:00
renovate[bot]
625b9ffca4
chore(deps): update dependency arm64v8/alpine to v3.16 (#14) 2022-05-24 08:55:30 +02:00
Renovate Bot
9736a62f46 chore(deps): update dependency golangci/golangci-lint to v1.46.2 2022-05-23 04:31:05 +00:00
1d97da5afa
reorder docs 2022-05-22 22:50:14 +02:00
816088a1c1
docs: refactor plugin properties 2022-05-22 22:42:03 +02:00
26 changed files with 638 additions and 1195 deletions

View File

@ -5,3 +5,4 @@ gh
drone-s3-sync
(s|S)3
cloudfront
Minio

View File

@ -1,2 +0,0 @@
*
!dist/

View File

@ -1,352 +0,0 @@
local PipelineTest = {
kind: 'pipeline',
name: 'test',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'deps',
image: 'golang:1.18',
commands: [
'make deps',
],
volumes: [
{
name: 'godeps',
path: '/go',
},
],
},
{
name: 'lint',
image: 'golang:1.18',
commands: [
'make lint',
],
volumes: [
{
name: 'godeps',
path: '/go',
},
],
},
{
name: 'test',
image: 'golang:1.18',
commands: [
'make test',
],
volumes: [
{
name: 'godeps',
path: '/go',
},
],
},
],
volumes: [
{
name: 'godeps',
temp: {},
},
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildBinaries = {
kind: 'pipeline',
name: 'build-binaries',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
name: 'build',
image: 'techknowlogick/xgo:go-1.18.x',
commands: [
'make release',
],
},
{
name: 'executable',
image: 'alpine',
commands: [
'$(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help',
],
},
{
name: 'changelog-generate',
image: 'thegeeklab/git-chglog',
commands: [
'git fetch -tq',
'git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}',
],
},
{
name: 'changelog-format',
image: 'thegeeklab/alpine-tools',
commands: [
'prettier CHANGELOG.md',
'prettier -w CHANGELOG.md',
],
},
{
name: 'publish',
image: 'plugins/github-release',
settings: {
overwrite: true,
api_key: {
from_secret: 'github_token',
},
files: ['dist/*'],
title: '${DRONE_TAG}',
note: 'CHANGELOG.md',
},
when: {
ref: [
'refs/tags/**',
],
},
},
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineBuildContainer(arch='amd64') = {
kind: 'pipeline',
name: 'build-container-' + arch,
platform: {
os: 'linux',
arch: arch,
},
steps: [
{
name: 'build',
image: 'golang:1.18',
commands: [
'make build',
'ls -l dist/drone-s3-sync',
],
},
{
name: 'dryrun',
image: 'thegeeklab/drone-docker:19',
settings: {
dry_run: true,
dockerfile: 'docker/Dockerfile.' + arch,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
},
depends_on: ['build'],
when: {
ref: ['refs/pull/**'],
},
},
{
name: 'publish-dockerhub',
image: 'thegeeklab/drone-docker:19',
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + arch,
repo: 'thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
depends_on: ['dryrun'],
},
{
name: 'publish-quay',
image: 'thegeeklab/drone-docker:19',
settings: {
auto_tag: true,
auto_tag_suffix: arch,
dockerfile: 'docker/Dockerfile.' + arch,
registry: 'quay.io',
repo: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
},
when: {
ref: ['refs/heads/main', 'refs/tags/**'],
},
depends_on: ['dryrun'],
},
],
depends_on: [
'test',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineDocs = {
kind: 'pipeline',
name: 'docs',
platform: {
os: 'linux',
arch: 'amd64',
},
concurrency: {
limit: 1,
},
steps: [
{
name: 'markdownlint',
image: 'thegeeklab/markdownlint-cli',
commands: [
"markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'",
],
},
{
name: 'spellcheck',
image: 'node:lts-alpine',
commands: [
'npm install -g spellchecker-cli',
"spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions",
],
environment: {
FORCE_COLOR: true,
NPM_CONFIG_LOGLEVEL: 'error',
},
},
{
name: 'publish',
image: 'plugins/gh-pages',
settings: {
username: { from_secret: 'github_username' },
password: { from_secret: 'github_token' },
pages_directory: '_docs/',
target_branch: 'docs',
},
when: {
ref: ['refs/heads/main'],
},
},
],
depends_on: [
'build-binaries',
'build-container-amd64',
'build-container-arm64',
'build-container-arm',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**', 'refs/pull/**'],
},
};
local PipelineNotifications = {
kind: 'pipeline',
name: 'notifications',
platform: {
os: 'linux',
arch: 'amd64',
},
steps: [
{
image: 'plugins/manifest',
name: 'manifest-dockerhub',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: 'docker_username' },
password: { from_secret: 'docker_password' },
spec: 'docker/manifest.tmpl',
},
when: {
status: ['success'],
},
},
{
image: 'plugins/manifest',
name: 'manifest-quay',
settings: {
ignore_missing: true,
auto_tag: true,
username: { from_secret: 'quay_username' },
password: { from_secret: 'quay_password' },
spec: 'docker/manifest-quay.tmpl',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-dockerhub',
image: 'chko/docker-pushrm:1',
environment: {
DOCKER_PASS: {
from_secret: 'docker_password',
},
DOCKER_USER: {
from_secret: 'docker_username',
},
PUSHRM_FILE: 'README.md',
PUSHRM_SHORT: 'Drone plugin to synchronize a directory with an S3 bucket',
PUSHRM_TARGET: 'thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'pushrm-quay',
image: 'chko/docker-pushrm:1',
environment: {
APIKEY__QUAY_IO: {
from_secret: 'quay_token',
},
PUSHRM_FILE: 'README.md',
PUSHRM_TARGET: 'quay.io/thegeeklab/${DRONE_REPO_NAME}',
},
when: {
status: ['success'],
},
},
{
name: 'matrix',
image: 'thegeeklab/drone-matrix',
settings: {
homeserver: { from_secret: 'matrix_homeserver' },
roomid: { from_secret: 'matrix_roomid' },
template: 'Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}<br/> Message: {{ commit.Message.Title }}',
username: { from_secret: 'matrix_username' },
password: { from_secret: 'matrix_password' },
},
when: {
status: ['success', 'failure'],
},
},
],
depends_on: [
'docs',
],
trigger: {
ref: ['refs/heads/main', 'refs/tags/**'],
status: ['success', 'failure'],
},
};
[
PipelineTest,
PipelineBuildBinaries,
PipelineBuildContainer(arch='amd64'),
PipelineBuildContainer(arch='arm64'),
PipelineBuildContainer(arch='arm'),
PipelineDocs,
PipelineNotifications,
]

View File

@ -1,462 +0,0 @@
---
kind: pipeline
name: test
platform:
os: linux
arch: amd64
steps:
- name: deps
image: golang:1.18
commands:
- make deps
volumes:
- name: godeps
path: /go
- name: lint
image: golang:1.18
commands:
- make lint
volumes:
- name: godeps
path: /go
- name: test
image: golang:1.18
commands:
- make test
volumes:
- name: godeps
path: /go
volumes:
- name: godeps
temp: {}
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
---
kind: pipeline
name: build-binaries
platform:
os: linux
arch: amd64
steps:
- name: build
image: techknowlogick/xgo:go-1.18.x
commands:
- make release
- name: executable
image: alpine
commands:
- $(find dist/ -executable -type f -iname ${DRONE_REPO_NAME}-linux-amd64) --help
- name: changelog-generate
image: thegeeklab/git-chglog
commands:
- git fetch -tq
- git-chglog --no-color --no-emoji -o CHANGELOG.md ${DRONE_TAG:---next-tag unreleased unreleased}
- name: changelog-format
image: thegeeklab/alpine-tools
commands:
- prettier CHANGELOG.md
- prettier -w CHANGELOG.md
- name: publish
image: plugins/github-release
settings:
api_key:
from_secret: github_token
files:
- dist/*
note: CHANGELOG.md
overwrite: true
title: ${DRONE_TAG}
when:
ref:
- refs/tags/**
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
depends_on:
- test
---
kind: pipeline
name: build-container-amd64
platform:
os: linux
arch: amd64
steps:
- name: build
image: golang:1.18
commands:
- make build
- ls -l dist/drone-s3-sync
- name: dryrun
image: thegeeklab/drone-docker:19
settings:
dockerfile: docker/Dockerfile.amd64
dry_run: true
repo: thegeeklab/${DRONE_REPO_NAME}
when:
ref:
- refs/pull/**
depends_on:
- build
- name: publish-dockerhub
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: amd64
dockerfile: docker/Dockerfile.amd64
password:
from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/main
- refs/tags/**
depends_on:
- dryrun
- name: publish-quay
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: amd64
dockerfile: docker/Dockerfile.amd64
password:
from_secret: quay_password
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: quay_username
when:
ref:
- refs/heads/main
- refs/tags/**
depends_on:
- dryrun
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
depends_on:
- test
---
kind: pipeline
name: build-container-arm64
platform:
os: linux
arch: arm64
steps:
- name: build
image: golang:1.18
commands:
- make build
- ls -l dist/drone-s3-sync
- name: dryrun
image: thegeeklab/drone-docker:19
settings:
dockerfile: docker/Dockerfile.arm64
dry_run: true
repo: thegeeklab/${DRONE_REPO_NAME}
when:
ref:
- refs/pull/**
depends_on:
- build
- name: publish-dockerhub
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm64
dockerfile: docker/Dockerfile.arm64
password:
from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/main
- refs/tags/**
depends_on:
- dryrun
- name: publish-quay
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm64
dockerfile: docker/Dockerfile.arm64
password:
from_secret: quay_password
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: quay_username
when:
ref:
- refs/heads/main
- refs/tags/**
depends_on:
- dryrun
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
depends_on:
- test
---
kind: pipeline
name: build-container-arm
platform:
os: linux
arch: arm
steps:
- name: build
image: golang:1.18
commands:
- make build
- ls -l dist/drone-s3-sync
- name: dryrun
image: thegeeklab/drone-docker:19
settings:
dockerfile: docker/Dockerfile.arm
dry_run: true
repo: thegeeklab/${DRONE_REPO_NAME}
when:
ref:
- refs/pull/**
depends_on:
- build
- name: publish-dockerhub
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm
dockerfile: docker/Dockerfile.arm
password:
from_secret: docker_password
repo: thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: docker_username
when:
ref:
- refs/heads/main
- refs/tags/**
depends_on:
- dryrun
- name: publish-quay
image: thegeeklab/drone-docker:19
settings:
auto_tag: true
auto_tag_suffix: arm
dockerfile: docker/Dockerfile.arm
password:
from_secret: quay_password
registry: quay.io
repo: quay.io/thegeeklab/${DRONE_REPO_NAME}
username:
from_secret: quay_username
when:
ref:
- refs/heads/main
- refs/tags/**
depends_on:
- dryrun
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
depends_on:
- test
---
kind: pipeline
name: docs
platform:
os: linux
arch: amd64
concurrency:
limit: 1
steps:
- name: markdownlint
image: thegeeklab/markdownlint-cli
commands:
- markdownlint 'docs/content/**/*.md' 'README.md' 'CONTRIBUTING.md'
- name: spellcheck
image: node:lts-alpine
commands:
- npm install -g spellchecker-cli
- spellchecker --files '_docs/**/*.md' 'README.md' 'CONTRIBUTING.md' -d .dictionary -p spell indefinite-article syntax-urls --no-suggestions
environment:
FORCE_COLOR: true
NPM_CONFIG_LOGLEVEL: error
- name: publish
image: plugins/gh-pages
settings:
pages_directory: _docs/
password:
from_secret: github_token
target_branch: docs
username:
from_secret: github_username
when:
ref:
- refs/heads/main
trigger:
ref:
- refs/heads/main
- refs/tags/**
- refs/pull/**
depends_on:
- build-binaries
- build-container-amd64
- build-container-arm64
- build-container-arm
---
kind: pipeline
name: notifications
platform:
os: linux
arch: amd64
steps:
- name: manifest-dockerhub
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: docker_password
spec: docker/manifest.tmpl
username:
from_secret: docker_username
when:
status:
- success
- name: manifest-quay
image: plugins/manifest
settings:
auto_tag: true
ignore_missing: true
password:
from_secret: quay_password
spec: docker/manifest-quay.tmpl
username:
from_secret: quay_username
when:
status:
- success
- name: pushrm-dockerhub
image: chko/docker-pushrm:1
environment:
DOCKER_PASS:
from_secret: docker_password
DOCKER_USER:
from_secret: docker_username
PUSHRM_FILE: README.md
PUSHRM_SHORT: Drone plugin to synchronize a directory with an S3 bucket
PUSHRM_TARGET: thegeeklab/${DRONE_REPO_NAME}
when:
status:
- success
- name: pushrm-quay
image: chko/docker-pushrm:1
environment:
APIKEY__QUAY_IO:
from_secret: quay_token
PUSHRM_FILE: README.md
PUSHRM_TARGET: quay.io/thegeeklab/${DRONE_REPO_NAME}
when:
status:
- success
- name: matrix
image: thegeeklab/drone-matrix
settings:
homeserver:
from_secret: matrix_homeserver
password:
from_secret: matrix_password
roomid:
from_secret: matrix_roomid
template: "Status: **{{ build.Status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.Link }}){{#if build.Branch}} ({{ build.Branch }}){{/if}} by {{ commit.Author }}<br/> Message: {{ commit.Message.Title }}"
username:
from_secret: matrix_username
when:
status:
- success
- failure
trigger:
ref:
- refs/heads/main
- refs/tags/**
status:
- success
- failure
depends_on:
- docs
---
kind: signature
hmac: dc305412e0b8b116d59630f50063f5b0a38441bf4a4e685f9bcb0e5ad9784cc7
...

View File

@ -52,14 +52,17 @@ branches:
strict: false
contexts:
- continuous-integration/drone/pr
enforce_admins: null
enforce_admins: true
required_linear_history: true
restrictions: null
- name: docs
protection:
required_pull_request_reviews: null
required_status_checks: null
enforce_admins: true
required_linear_history: true
restrictions:
apps: []
users: []
teams:
- bot

View File

@ -1,25 +1,91 @@
linters:
enable:
- gosimple
- deadcode
- typecheck
- govet
- errcheck
- staticcheck
- unused
- structcheck
- varcheck
- dupl
- gofmt
- misspell
- gocritic
- bidichk
- ineffassign
- revive
- gofumpt
- depguard
enable-all: false
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- typecheck
- unused
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- decorder
- dogsled
- dupl
- dupword
- durationcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exportloopref
- forcetypeassert
- ginkgolinter
- gocheckcompilerdirectives
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godot
- godox
- goerr113
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- grouper
- importas
- interfacebloat
- ireturn
- lll
- loggercheck
- maintidx
- makezero
- misspell
- musttag
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
- prealloc
- predeclared
- promlinter
- reassign
- revive
# - rowserrcheck
# - sqlclosecheck
# - structcheck
- stylecheck
- tagliatelle
- tenv
- testableexamples
- thelper
- tparallel
- unconvert
- unparam
- usestdlibvars
# - wastedassign
- whitespace
- wsl
fast: false
run:
@ -28,4 +94,4 @@ run:
linters-settings:
gofumpt:
extra-rules: true
lang-version: "1.18"
lang-version: "1.20"

View File

@ -3,7 +3,7 @@
## Security
If you think you have found a **security issue**, please do not mention it in this repository.
Instead, send an email to security@thegeeklab.de with as many details as possible so it can be handled confidential.
Instead, send an email to `security@thegeeklab.de` with as many details as possible so it can be handled confidential.
## Bug Reports and Feature Requests

View File

@ -1,4 +1,14 @@
FROM alpine:3.15@sha256:4edbd2beb5f78b1014028f4fbb99f3237d9561100b6881aabbf5acce2c4f9454
FROM --platform=$BUILDPLATFORM golang:1.20@sha256:839ba88412b5d3e12d66ed4774a85fc6e6c644dce8074ab82c798e5db27d4a09 as build
ARG TARGETOS
ARG TARGETARCH
ADD . /src
WORKDIR /src
RUN make build
FROM alpine:3.18@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
@ -7,6 +17,5 @@ LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-s3-sync"
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-s3-sync"
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-s3-sync"
ADD dist/drone-s3-sync /bin/
COPY --from=build /src/dist/drone-s3-sync /bin/drone-s3-sync
ENTRYPOINT ["/bin/drone-s3-sync"]

View File

@ -1,7 +1,7 @@
# renovate: datasource=github-releases depName=mvdan/gofumpt
GOFUMPT_PACKAGE_VERSION := v0.3.1
GOFUMPT_PACKAGE_VERSION := v0.5.0
# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANGCI_LINT_PACKAGE_VERSION := v1.45.2
GOLANGCI_LINT_PACKAGE_VERSION := v1.54.1
EXECUTABLE := drone-s3-sync
@ -19,10 +19,15 @@ GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@$(G
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
GENERATE ?=
XGO_VERSION := go-1.18.x
XGO_VERSION := go-1.20.x
XGO_TARGETS ?= linux/amd64,linux/arm-6,linux/arm-7,linux/arm64
TAGS ?= netgo
TARGETOS ?= linux
TARGETARCH ?= amd64
ifneq ("$(TARGETVARIANT)","")
GOARM ?= $(subst v,,$(TARGETVARIANT))
endif
TAGS ?= netgo,osusergo
ifndef VERSION
ifneq ($(DRONE_TAG),)
@ -69,7 +74,7 @@ test:
build: $(DIST)/$(EXECUTABLE)
$(DIST)/$(EXECUTABLE): $(SOURCES)
$(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) GOARM=$(GOARM) $(GO) build -v -tags '$(TAGS)' -ldflags '-extldflags "-static" $(LDFLAGS)' -o $@ ./cmd/$(EXECUTABLE)
$(DIST_DIRS):
mkdir -p $(DIST_DIRS)

View File

@ -1,6 +1,6 @@
# drone-s3-sync
Drone plugin to synchronize a directory with an S3 bucket
DISCONTINUED: Drone plugin to synchronize a directory with an S3 bucket
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-s3-sync?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-s3-sync)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-s3-sync)
@ -10,11 +10,13 @@ Drone plugin to synchronize a directory with an S3 bucket
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-s3-sync)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/blob/main/LICENSE)
Drone plugin to synchronize a directory with an S3 bucket. You can find the full documentation at You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-s3-sync).
> **DISCONTINUED:** As I don't use Drone CI anymore, this project is unmaintained. If you are interested in a free and open source CI system check out [Woodpecker CI](https://woodpecker-ci.org/).
Drone plugin to synchronize a directory with an S3 bucket. You can find the full documentation at [https://drone-plugin-index.geekdocs.de](https://drone-plugin-index.geekdocs.de/plugins/drone-s3-sync).
## Contributors
Special thanks goes to all [contributors](https://github.com/thegeeklab/drone-s3-sync/graphs/contributors). If you would like to contribute, please see the [instructions](https://github.com/thegeeklab/drone-s3-sync/blob/main/CONTRIBUTING.md).
Special thanks to all [contributors](https://github.com/thegeeklab/drone-s3-sync/graphs/contributors). If you would like to contribute, please see the [instructions](https://github.com/thegeeklab/drone-s3-sync/blob/main/CONTRIBUTING.md).
## License

View File

@ -1,105 +0,0 @@
---
title: drone-s3-sync
---
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-s3-sync?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-s3-sync)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-s3-sync)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-s3-sync)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/graphs/contributors)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-s3-sync)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/blob/main/LICENSE)
Drone plugin to synchronize a directory with an S3 bucket.
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< toc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Build
Build the binary with the following command:
```Shell
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
make build
```
Build the Docker image with the following command:
```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-s3-sync .
```
## Usage
```Shell
docker run --rm \
-e PLUGIN_BUCKET=my_bucket \
-e AWS_ACCESS_KEY_ID=abc123 \
-e AWS_SECRET_ACCESS_KEY=xyc789 \
-v $(pwd):$(pwd) \
-w $(pwd) \
thegeeklab/drone-s3-sync
```
### Parameters
endpoint
: endpoint for the s3 connection
access-key
: s3 access key
secret-key
: s3 secret key
path-style
: use path style for bucket paths
bucket
: name of the bucket
region
: s3 region (default `us-east-1`)
source
: upload source path (default `.`)
target
: target path (default `/`)
delete
: delete locally removed files from the target
access
: access control settings
content-type
: content-type settings for uploads
content-encoding
: content-encoding settings for uploads
cache_control
: cache-control settings for uploads
metadata
: additional metadata for uploads
redirects
: redirects to create
cloudfront-distribution
: id of cloudfront distribution to invalidate
dry_run
: dry run disables api calls
max_concurrency
: customize number concurrent files to process (default `100`)

132
_docs/content/_index.md Normal file
View File

@ -0,0 +1,132 @@
---
title: drone-s3-sync
---
[![Build Status](https://img.shields.io/drone/build/thegeeklab/drone-s3-sync?logo=drone&server=https%3A%2F%2Fdrone.thegeeklab.de)](https://drone.thegeeklab.de/thegeeklab/drone-s3-sync)
[![Docker Hub](https://img.shields.io/badge/dockerhub-latest-blue.svg?logo=docker&logoColor=white)](https://hub.docker.com/r/thegeeklab/drone-s3-sync)
[![Quay.io](https://img.shields.io/badge/quay-latest-blue.svg?logo=docker&logoColor=white)](https://quay.io/repository/thegeeklab/drone-s3-sync)
[![GitHub contributors](https://img.shields.io/github/contributors/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/graphs/contributors)
[![Source: GitHub](https://img.shields.io/badge/source-github-blue.svg?logo=github&logoColor=white)](https://github.com/thegeeklab/drone-s3-sync)
[![License: MIT](https://img.shields.io/github/license/thegeeklab/drone-s3-sync)](https://github.com/thegeeklab/drone-s3-sync/blob/main/LICENSE)
Drone plugin to synchronize a directory with an S3 bucket.
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< toc >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
## Usage
```YAML
kind: pipeline
name: default
steps:
- name: sync
image: thegeeklab/drone-s3-sync
settings:
access_key: a50d28f4dd477bc184fbd10b376de753
secret_key: bc5785d3ece6a9cdefa42eb99b58986f9095ff1c
region: us-east-1
bucket: my-bucket.s3-website-us-east-1.amazonaws.com
source: folder/to/archive
target: /target/location
```
### Parameters
<!-- prettier-ignore-start -->
<!-- spellchecker-disable -->
{{< propertylist name=drone-s3-sync.data sort=name >}}
<!-- spellchecker-enable -->
<!-- prettier-ignore-end -->
### Examples
**Customize `acl`, `content_type`, `content_encoding` or `cache_control`:**
```YAML
kind: pipeline
name: default
steps:
- name: sync
image: thegeeklab/drone-s3-sync
settings:
access_key: a50d28f4dd477bc184fbd10b376de753
secret_key: bc5785d3ece6a9cdefa42eb99b58986f9095ff1c
region: us-east-1
bucket: my-bucket.s3-website-us-east-1.amazonaws.com
source: folder/to/archive
target: /target/location
acl:
"public/*": public-read
"private/*": private
content_type:
".svg": image/svg+xml
content_encoding:
".js": gzip
".css": gzip
cache_control: "public, max-age: 31536000"
```
All `map` parameters can be specified as `map` for a subset of files or as `string` for all files.
- For the `acl` parameter the key must be a glob. Files without a matching rule will default to `private`.
- For the `content_type` parameter, the key must be a file extension (including the leading dot). To apply a configuration to files without extension, the key can be set to an empty string `""`. For files without a matching rule, the content type is determined automatically.
- For the `content_encoding` parameter, the key must be a file extension (including the leading dot). To apply a configuration to files without extension, the key can be set to an empty string `""`. For files without a matching rule, no Content Encoding header is set.
- For the `cache_control` parameter, the key must be a file extension (including the leading dot). If you want to set cache control for files without an extension, set the key to the empty string `""`. For files without a matching rule, no Cache Control header is set.
**Sync to Minio S3:**
To use [Minio S3](https://docs.min.io/) its required to set `path_style: true`.
```YAML
kind: pipeline
name: default
steps:
- name: sync
image: thegeeklab/drone-s3-sync
settings:
endpoint: https://minio.example.com
access_key: a50d28f4dd477bc184fbd10b376de753
secret_key: bc5785d3ece6a9cdefa42eb99b58986f9095ff1c
bucket: my-bucket
source: folder/to/archive
target: /target/location
path_style: true
```
## Build
Build the binary with the following command:
```Shell
export GOOS=linux
export GOARCH=amd64
export CGO_ENABLED=0
export GO111MODULE=on
make build
```
Build the Docker image with the following command:
```Shell
docker build --file docker/Dockerfile.amd64 --tag thegeeklab/drone-s3-sync .
```
## Test
```Shell
docker run --rm \
-e PLUGIN_BUCKET=my_bucket \
-e AWS_ACCESS_KEY_ID=abc123 \
-e AWS_SECRET_ACCESS_KEY=xyc789 \
-v $(pwd):$(pwd) \
-w $(pwd) \
thegeeklab/drone-s3-sync
```

94
_docs/data/data.yaml Normal file
View File

@ -0,0 +1,94 @@
---
properties:
- name: endpoint
description: Endpoint for the s3 connection.
type: string
required: false
- name: access-key
description: S3 access key.
type: string
required: false
- name: secret-key
description: S3 secret key.
type: string
required: false
- name: path-style
description: Enable path style for bucket paths.
type: bool
required: false
- name: bucket
description: Name of the bucket.
type: string
required: true
- name: region
description: S3 region.
defaultValue: us-east-1
type: string
required: false
- name: source
description: Upload source path.
defaultValue: .
type: string
required: false
- name: target
description: Upload target path.
defaultValue: /
type: string
required: false
- name: delete
description: Delete locally removed files from the target.
type: bool
required: false
- name: acl
description: Access control list.
type: map
required: false
- name: content-type
description: Content-type settings for uploads.
type: map
required: false
- name: content-encoding
description: Content-encoding settings for uploads.
type: map
required: false
- name: cache_control
description: Cache-control settings for uploads.
type: map
required: false
- name: metadata
description: Additional metadata for uploads.
type: map
required: false
- name: redirects
description: Redirects to create.
type: map
required: false
- name: cloudfront-distribution
description: ID of cloudfront distribution to invalidate.
type: string
required: false
- name: dry_run
description: Dry run disables API calls.
type: bool
required: false
- name: max_concurrency
description: Customize number of concurrent files to process.
defaultValue: 100
type: int

View File

@ -6,37 +6,45 @@ import (
)
// settingsFlags has the cli.Flags for the plugin.Settings.
func settingsFlags(settings *plugin.Settings) []cli.Flag {
func settingsFlags(settings *plugin.Settings, category string) []cli.Flag {
return []cli.Flag{
&cli.StringFlag{
Name: "endpoint",
Usage: "endpoint for the s3 connection",
EnvVars: []string{"PLUGIN_ENDPOINT", "S3_ENDPOINT"},
Destination: &settings.Endpoint,
Category: category,
},
&cli.StringFlag{
Name: "access-key",
Usage: "s3 access key",
EnvVars: []string{"PLUGIN_ACCESS_KEY", "S3_ACCESS_KEY"},
Destination: &settings.AccessKey,
Required: true,
Category: category,
},
&cli.StringFlag{
Name: "secret-key",
Usage: "s3 secret key",
EnvVars: []string{"PLUGIN_SECRET_KEY", "S3_SECRET_KEY"},
Destination: &settings.SecretKey,
Required: true,
Category: category,
},
&cli.BoolFlag{
Name: "path-style",
Usage: "use path style for bucket paths",
Usage: "enable path style for bucket paths",
EnvVars: []string{"PLUGIN_PATH_STYLE"},
Destination: &settings.PathStyle,
Category: category,
},
&cli.StringFlag{
Name: "bucket",
Usage: "name of the bucket",
EnvVars: []string{"PLUGIN_BUCKET"},
Destination: &settings.Bucket,
Required: true,
Category: category,
},
&cli.StringFlag{
Name: "region",
@ -44,6 +52,7 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Value: "us-east-1",
EnvVars: []string{"PLUGIN_REGION"},
Destination: &settings.Region,
Category: category,
},
&cli.StringFlag{
Name: "source",
@ -51,74 +60,87 @@ func settingsFlags(settings *plugin.Settings) []cli.Flag {
Value: ".",
EnvVars: []string{"PLUGIN_SOURCE"},
Destination: &settings.Source,
Category: category,
},
&cli.StringFlag{
Name: "target",
Usage: "target path",
Usage: "upload target path",
Value: "/",
EnvVars: []string{"PLUGIN_TARGET"},
Destination: &settings.Target,
Category: category,
},
&cli.BoolFlag{
Name: "delete",
Usage: "delete locally removed files from the target",
EnvVars: []string{"PLUGIN_DELETE"},
Destination: &settings.Delete,
Category: category,
},
&cli.GenericFlag{
Name: "access",
Usage: "access control settings",
EnvVars: []string{"PLUGIN_ACCESS", "PLUGIN_ACL"},
Value: &StringMapFlag{},
Name: "acl",
Usage: "access control list",
EnvVars: []string{"PLUGIN_ACL"},
Value: &StringMapFlag{},
Category: category,
},
&cli.GenericFlag{
Name: "content-type",
Usage: "content-type settings for uploads",
EnvVars: []string{"PLUGIN_CONTENT_TYPE"},
Value: &StringMapFlag{},
Name: "content-type",
Usage: "content-type settings for uploads",
EnvVars: []string{"PLUGIN_CONTENT_TYPE"},
Value: &StringMapFlag{},
Category: category,
},
&cli.GenericFlag{
Name: "content-encoding",
Usage: "content-encoding settings for uploads",
EnvVars: []string{"PLUGIN_CONTENT_ENCODING"},
Value: &StringMapFlag{},
Name: "content-encoding",
Usage: "content-encoding settings for uploads",
EnvVars: []string{"PLUGIN_CONTENT_ENCODING"},
Value: &StringMapFlag{},
Category: category,
},
&cli.GenericFlag{
Name: "cache-control",
Usage: "cache-control settings for uploads",
EnvVars: []string{"PLUGIN_CACHE_CONTROL"},
Value: &StringMapFlag{},
Name: "cache-control",
Usage: "cache-control settings for uploads",
EnvVars: []string{"PLUGIN_CACHE_CONTROL"},
Value: &StringMapFlag{},
Category: category,
},
&cli.GenericFlag{
Name: "metadata",
Usage: "additional metadata for uploads",
EnvVars: []string{"PLUGIN_METADATA"},
Value: &DeepStringMapFlag{},
Name: "metadata",
Usage: "additional metadata for uploads",
EnvVars: []string{"PLUGIN_METADATA"},
Value: &DeepStringMapFlag{},
Category: category,
},
&cli.GenericFlag{
Name: "redirects",
Usage: "redirects to create",
EnvVars: []string{"PLUGIN_REDIRECTS"},
Value: &MapFlag{},
Name: "redirects",
Usage: "redirects to create",
EnvVars: []string{"PLUGIN_REDIRECTS"},
Value: &MapFlag{},
Category: category,
},
&cli.StringFlag{
Name: "cloudfront-distribution",
Usage: "id of cloudfront distribution to invalidate",
EnvVars: []string{"PLUGIN_CLOUDFRONT_DISTRIBUTION"},
Destination: &settings.CloudFrontDistribution,
Category: category,
},
&cli.BoolFlag{
Name: "dry-run",
Usage: "dry run disables api calls",
EnvVars: []string{"DRY_RUN", "PLUGIN_DRY_RUN"},
Destination: &settings.DryRun,
Category: category,
},
&cli.IntFlag{
Name: "max-concurrency",
Usage: "customize number concurrent files to process",
Name: "max-concurrency",
Usage: "customize number concurrent files to process",
//nolint:gomnd
Value: 100,
EnvVars: []string{"PLUGIN_MAX_CONCURRENCY"},
Destination: &settings.MaxConcurrency,
Category: category,
},
}
}

View File

@ -1,21 +1,25 @@
package main
import (
"errors"
"fmt"
"os"
"github.com/joho/godotenv"
"github.com/thegeeklab/drone-plugin-lib/errors"
"github.com/thegeeklab/drone-plugin-lib/urfave"
"github.com/sirupsen/logrus"
"github.com/thegeeklab/drone-plugin-lib/v2/urfave"
"github.com/thegeeklab/drone-s3-sync/plugin"
"github.com/urfave/cli/v2"
)
//nolint:gochecknoglobals
var (
BuildVersion = "devel"
BuildDate = "00000000"
)
var ErrTypeAssertionFailed = errors.New("type assertion failed")
func main() {
settings := &plugin.Settings{}
@ -31,12 +35,12 @@ func main() {
Name: "drone-s3-sync",
Usage: "synchronize a directory with an S3 bucket",
Version: BuildVersion,
Flags: append(settingsFlags(settings), urfave.Flags()...),
Flags: append(settingsFlags(settings, urfave.FlagsPluginCategory), urfave.Flags()...),
Action: run(settings),
}
if err := app.Run(os.Args); err != nil {
errors.HandleExit(err)
logrus.Fatal(err)
}
}
@ -44,12 +48,42 @@ func run(settings *plugin.Settings) cli.ActionFunc {
return func(ctx *cli.Context) error {
urfave.LoggingFromContext(ctx)
settings.Access = ctx.Generic("access").(*StringMapFlag).Get()
settings.CacheControl = ctx.Generic("cache-control").(*StringMapFlag).Get()
settings.ContentType = ctx.Generic("content-type").(*StringMapFlag).Get()
settings.ContentEncoding = ctx.Generic("content-encoding").(*StringMapFlag).Get()
settings.Metadata = ctx.Generic("metadata").(*DeepStringMapFlag).Get()
settings.Redirects = ctx.Generic("redirects").(*MapFlag).Get()
acl, ok := ctx.Generic("acl").(*StringMapFlag)
if !ok {
return fmt.Errorf("%w: failed to read acl input", ErrTypeAssertionFailed)
}
cacheControl, ok := ctx.Generic("cache-control").(*StringMapFlag)
if !ok {
return fmt.Errorf("%w: failed to read cache-control input", ErrTypeAssertionFailed)
}
contentType, ok := ctx.Generic("content-type").(*StringMapFlag)
if !ok {
return fmt.Errorf("%w: failed to read content-type input", ErrTypeAssertionFailed)
}
contentEncoding, ok := ctx.Generic("content-encoding").(*StringMapFlag)
if !ok {
return fmt.Errorf("%w: failed to read content-encoding input", ErrTypeAssertionFailed)
}
metadata, ok := ctx.Generic("metadata").(*DeepStringMapFlag)
if !ok {
return fmt.Errorf("%w: failed to read metadata input", ErrTypeAssertionFailed)
}
redirects, ok := ctx.Generic("redirects").(*MapFlag)
if !ok {
return fmt.Errorf("%w: failed to read redirects input", ErrTypeAssertionFailed)
}
settings.ACL = acl.Get()
settings.CacheControl = cacheControl.Get()
settings.ContentType = contentType.Get()
settings.ContentEncoding = contentEncoding.Get()
settings.Metadata = metadata.Get()
settings.Redirects = redirects.Get()
plugin := plugin.New(
*settings,
@ -58,20 +92,11 @@ func run(settings *plugin.Settings) cli.ActionFunc {
)
if err := plugin.Validate(); err != nil {
if e, ok := err.(errors.ExitCoder); ok {
return e
}
return errors.ExitMessagef("validation failed: %w", err)
return fmt.Errorf("validation failed: %w", err)
}
if err := plugin.Execute(); err != nil {
if e, ok := err.(errors.ExitCoder); ok {
return e
}
return errors.ExitMessagef("execution failed: %w", err)
return fmt.Errorf("execution failed: %w", err)
}
return nil

View File

@ -18,9 +18,11 @@ func (d *DeepStringMapFlag) Get() map[string]map[string]string {
func (d *DeepStringMapFlag) Set(value string) error {
d.parts = map[string]map[string]string{}
err := json.Unmarshal([]byte(value), &d.parts)
if err != nil {
single := map[string]string{}
err := json.Unmarshal([]byte(value), &single)
if err != nil {
return err
@ -46,10 +48,12 @@ func (s *StringMapFlag) Get() map[string]string {
func (s *StringMapFlag) Set(value string) error {
s.parts = map[string]string{}
err := json.Unmarshal([]byte(value), &s.parts)
if err != nil {
s.parts["*"] = value
}
return nil
}
@ -67,5 +71,6 @@ func (m *MapFlag) Get() map[string]string {
func (m *MapFlag) Set(value string) error {
m.parts = map[string]string{}
return json.Unmarshal([]byte(value), &m.parts)
}

View File

@ -1,12 +0,0 @@
FROM arm32v7/alpine:3.15@sha256:dc18010aabc13ce121123c7bb0f4dcb6879ce22b4f7c65669a2c634b5ceecafb
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.title="drone-s3-sync"
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-s3-sync"
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-s3-sync"
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-s3-sync"
ADD dist/drone-s3-sync /bin/
ENTRYPOINT ["/bin/drone-s3-sync"]

View File

@ -1,12 +0,0 @@
FROM arm64v8/alpine:3.15@sha256:f3bec467166fd0e38f83ff32fb82447f5e89b5abd13264a04454c75e11f1cdc6
LABEL maintainer="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.authors="Robert Kaussow <mail@thegeeklab.de>"
LABEL org.opencontainers.image.title="drone-s3-sync"
LABEL org.opencontainers.image.url="https://github.com/thegeeklab/drone-s3-sync"
LABEL org.opencontainers.image.source="https://github.com/thegeeklab/drone-s3-sync"
LABEL org.opencontainers.image.documentation="https://github.com/thegeeklab/drone-s3-sync"
ADD dist/drone-s3-sync /bin/
ENTRYPOINT ["/bin/drone-s3-sync"]

View File

@ -1,24 +0,0 @@
image: quay.io/thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: quay.io/thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux
- image: quay.io/thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: quay.io/thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
platform:
architecture: arm
os: linux
variant: v7

View File

@ -1,24 +0,0 @@
image: thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}{{else}}latest{{/if}}
{{#if build.tags}}
tags:
{{#each build.tags}}
- {{this}}
{{/each}}
{{/if}}
manifests:
- image: thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}amd64
platform:
architecture: amd64
os: linux
- image: thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm64
platform:
architecture: arm64
os: linux
variant: v8
- image: thegeeklab/drone-s3-sync:{{#if build.tag}}{{trimPrefix "v" build.tag}}-{{/if}}arm
platform:
architecture: arm
os: linux
variant: v7

17
go.mod
View File

@ -1,21 +1,20 @@
module github.com/thegeeklab/drone-s3-sync
go 1.18
go 1.20
require (
github.com/aws/aws-sdk-go v1.44.11
github.com/joho/godotenv v1.4.0
github.com/aws/aws-sdk-go v1.44.302
github.com/joho/godotenv v1.5.1
github.com/ryanuber/go-glob v1.0.0
github.com/sirupsen/logrus v1.8.1
github.com/thegeeklab/drone-plugin-lib v1.0.0
github.com/urfave/cli/v2 v2.6.0
github.com/sirupsen/logrus v1.9.3
github.com/thegeeklab/drone-plugin-lib/v2 v2.3.4
github.com/urfave/cli/v2 v2.25.7
)
require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/sys v0.2.0 // indirect
)

68
go.sum
View File

@ -1,5 +1,5 @@
github.com/aws/aws-sdk-go v1.44.11 h1:eIC59RrNY7xXYmGy/kKkLj4PGB325Jca22lcxZwbpBE=
github.com/aws/aws-sdk-go v1.44.11/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.302 h1:ST3ko6GrJKn3Xi+nAvxjG3uk/V1pW8KC52WLeIxqqNk=
github.com/aws/aws-sdk-go v1.44.302/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -9,8 +9,8 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@ -18,29 +18,51 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/thegeeklab/drone-plugin-lib v1.0.0 h1:PQeLnJa0q988rODYod/XtDy/f0cHHUhOA2Y8m5XRW4g=
github.com/thegeeklab/drone-plugin-lib v1.0.0/go.mod h1:XAlZDTSNNJogOH1+nS5u0notdj5dO/gtKnU7guzE95g=
github.com/urfave/cli/v2 v2.6.0 h1:yj2Drkflh8X/zUrkWlWlUjZYHyWN7WMmpVxyxXIUyv8=
github.com/urfave/cli/v2 v2.6.0/go.mod h1:oDzoM7pVwz6wHn5ogWgFUU1s4VJayeQS+aEZDqXIEJs=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA=
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/thegeeklab/drone-plugin-lib/v2 v2.3.4 h1:Quzrike/xRAR0izxQ0d+ocJyIUm4h1497Oyo9grcRzg=
github.com/thegeeklab/drone-plugin-lib/v2 v2.3.4/go.mod h1:qWVUZCmwL0Ntwa/hvyqM03EeIr1ReBR2XJsmIc7MGus=
github.com/urfave/cli/v2 v2.25.7 h1:VAzn5oq403l5pHjc4OhD54+XGO9cdKVL/7lDjF+iKUs=
github.com/urfave/cli/v2 v2.25.7/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -1,7 +1,9 @@
package plugin
import (
//nolint:gosec
"crypto/md5"
"errors"
"fmt"
"io"
"mime"
@ -28,20 +30,20 @@ type AWS struct {
plugin *Plugin
}
func NewAWS(p *Plugin) AWS {
func NewAWS(plugin *Plugin) AWS {
sessCfg := &aws.Config{
S3ForcePathStyle: aws.Bool(p.settings.PathStyle),
Region: aws.String(p.settings.Region),
S3ForcePathStyle: aws.Bool(plugin.settings.PathStyle),
Region: aws.String(plugin.settings.Region),
}
if p.settings.Endpoint != "" {
sessCfg.Endpoint = &p.settings.Endpoint
sessCfg.DisableSSL = aws.Bool(strings.HasPrefix(p.settings.Endpoint, "http://"))
if plugin.settings.Endpoint != "" {
sessCfg.Endpoint = &plugin.settings.Endpoint
sessCfg.DisableSSL = aws.Bool(strings.HasPrefix(plugin.settings.Endpoint, "http://"))
}
// allowing to use the instance role or provide a key and secret
if p.settings.AccessKey != "" && p.settings.SecretKey != "" {
sessCfg.Credentials = credentials.NewStaticCredentials(p.settings.AccessKey, p.settings.SecretKey, "")
if plugin.settings.AccessKey != "" && plugin.settings.SecretKey != "" {
sessCfg.Credentials = credentials.NewStaticCredentials(plugin.settings.AccessKey, plugin.settings.SecretKey, "")
}
sess, _ := session.NewSession(sessCfg)
@ -51,11 +53,13 @@ func NewAWS(p *Plugin) AWS {
r := make([]string, 1)
l := make([]string, 1)
return AWS{c, cf, r, l, p}
return AWS{c, cf, r, l, plugin}
}
//nolint:gocognit,gocyclo,maintidx
func (a *AWS) Upload(local, remote string) error {
p := a.plugin
plugin := a.plugin
if local == "" {
return nil
}
@ -67,24 +71,28 @@ func (a *AWS) Upload(local, remote string) error {
defer file.Close()
var access string
for pattern := range p.settings.Access {
var acl string
for pattern := range plugin.settings.ACL {
if match := glob.Glob(pattern, local); match {
access = p.settings.Access[pattern]
acl = plugin.settings.ACL[pattern]
break
}
}
if access == "" {
access = "private"
if acl == "" {
acl = "private"
}
fileExt := filepath.Ext(local)
var contentType string
for patternExt := range p.settings.ContentType {
for patternExt := range plugin.settings.ContentType {
if patternExt == fileExt {
contentType = p.settings.ContentType[patternExt]
contentType = plugin.settings.ContentType[patternExt]
break
}
}
@ -94,47 +102,62 @@ func (a *AWS) Upload(local, remote string) error {
}
var contentEncoding string
for patternExt := range p.settings.ContentEncoding {
for patternExt := range plugin.settings.ContentEncoding {
if patternExt == fileExt {
contentEncoding = p.settings.ContentEncoding[patternExt]
contentEncoding = plugin.settings.ContentEncoding[patternExt]
break
}
}
var cacheControl string
for pattern := range p.settings.CacheControl {
for pattern := range plugin.settings.CacheControl {
if match := glob.Glob(pattern, local); match {
cacheControl = p.settings.CacheControl[pattern]
cacheControl = plugin.settings.CacheControl[pattern]
break
}
}
metadata := map[string]*string{}
for pattern := range p.settings.Metadata {
for pattern := range plugin.settings.Metadata {
if match := glob.Glob(pattern, local); match {
for k, v := range p.settings.Metadata[pattern] {
for k, v := range plugin.settings.Metadata[pattern] {
metadata[k] = aws.String(v)
}
break
}
}
var AWSErr awserr.Error
head, err := a.client.HeadObject(&s3.HeadObjectInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(remote),
})
if err != nil && err.(awserr.Error).Code() != "404" {
if err != nil && errors.As(err, &AWSErr) {
//nolint:errorlint,forcetypeassert
if err.(awserr.Error).Code() == "404" {
return err
}
logrus.Debugf("'%s' not found in bucket, uploading with content-type '%s' and permissions '%s'", local, contentType, access)
logrus.Debugf(
"'%s' not found in bucket, uploading with content-type '%s' and permissions '%s'",
local,
contentType,
acl,
)
putObject := &s3.PutObjectInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(remote),
Body: file,
ContentType: aws.String(contentType),
ACL: aws.String(access),
ACL: aws.String(acl),
Metadata: metadata,
}
@ -152,48 +175,58 @@ func (a *AWS) Upload(local, remote string) error {
}
_, err = a.client.PutObject(putObject)
return err
}
//nolint:gosec
hash := md5.New()
_, _ = io.Copy(hash, file)
sum := fmt.Sprintf("'%x'", hash.Sum(nil))
//nolint:nestif
if sum == *head.ETag {
shouldCopy := false
if head.ContentType == nil && contentType != "" {
logrus.Debugf("content-type has changed from unset to %s", contentType)
shouldCopy = true
}
if !shouldCopy && head.ContentType != nil && contentType != *head.ContentType {
logrus.Debugf("content-type has changed from %s to %s", *head.ContentType, contentType)
shouldCopy = true
}
if !shouldCopy && head.ContentEncoding == nil && contentEncoding != "" {
logrus.Debugf("Content-Encoding has changed from unset to %s", contentEncoding)
shouldCopy = true
}
if !shouldCopy && head.ContentEncoding != nil && contentEncoding != *head.ContentEncoding {
logrus.Debugf("Content-Encoding has changed from %s to %s", *head.ContentEncoding, contentEncoding)
shouldCopy = true
}
if !shouldCopy && head.CacheControl == nil && cacheControl != "" {
logrus.Debugf("cache-control has changed from unset to %s", cacheControl)
shouldCopy = true
}
if !shouldCopy && head.CacheControl != nil && cacheControl != *head.CacheControl {
logrus.Debugf("cache-control has changed from %s to %s", *head.CacheControl, cacheControl)
shouldCopy = true
}
if !shouldCopy && len(head.Metadata) != len(metadata) {
logrus.Debugf("count of metadata values has changed for %s", local)
shouldCopy = true
}
@ -202,7 +235,9 @@ func (a *AWS) Upload(local, remote string) error {
if hv, ok := head.Metadata[k]; ok {
if *v != *hv {
logrus.Debugf("metadata values have changed for %s", local)
shouldCopy = true
break
}
}
@ -211,49 +246,54 @@ func (a *AWS) Upload(local, remote string) error {
if !shouldCopy {
grant, err := a.client.GetObjectAcl(&s3.GetObjectAclInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(remote),
})
if err != nil {
return err
}
previousAccess := "private"
for _, g := range grant.Grants {
gt := *g.Grantee
if gt.URI != nil {
if *gt.URI == "http://acs.amazonaws.com/groups/global/AllUsers" {
if *g.Permission == "READ" {
previousAccess = "public-read"
} else if *g.Permission == "WRITE" {
previousAccess = "public-read-write"
previousACL := "private"
for _, grant := range grant.Grants {
grantee := *grant.Grantee
if grantee.URI != nil {
if *grantee.URI == "http://acs.amazonaws.com/groups/global/AllUsers" {
if *grant.Permission == "READ" {
previousACL = "public-read"
} else if *grant.Permission == "WRITE" {
previousACL = "public-read-write"
}
}
if *gt.URI == "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" {
if *g.Permission == "READ" {
previousAccess = "authenticated-read"
if *grantee.URI == "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" {
if *grant.Permission == "READ" {
previousACL = "authenticated-read"
}
}
}
}
if previousAccess != access {
logrus.Debugf("permissions for '%s' have changed from '%s' to '%s'", remote, previousAccess, access)
if previousACL != acl {
logrus.Debugf("permissions for '%s' have changed from '%s' to '%s'", remote, previousACL, acl)
shouldCopy = true
}
}
if !shouldCopy {
logrus.Debugf("skipping '%s' because hashes and metadata match", local)
return nil
}
logrus.Debugf("updating metadata for '%s' content-type: '%s', ACL: '%s'", local, contentType, access)
logrus.Debugf("updating metadata for '%s' content-type: '%s', ACL: '%s'", local, contentType, acl)
copyObject := &s3.CopyObjectInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(remote),
CopySource: aws.String(fmt.Sprintf("%s/%s", p.settings.Bucket, remote)),
ACL: aws.String(access),
CopySource: aws.String(fmt.Sprintf("%s/%s", plugin.settings.Bucket, remote)),
ACL: aws.String(acl),
ContentType: aws.String(contentType),
Metadata: metadata,
MetadataDirective: aws.String("REPLACE"),
@ -273,6 +313,7 @@ func (a *AWS) Upload(local, remote string) error {
}
_, err = a.client.CopyObject(copyObject)
return err
}
@ -281,13 +322,14 @@ func (a *AWS) Upload(local, remote string) error {
return err
}
logrus.Debugf("uploading '%s' with content-type '%s' and permissions '%s'", local, contentType, access)
logrus.Debugf("uploading '%s' with content-type '%s' and permissions '%s'", local, contentType, acl)
putObject := &s3.PutObjectInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(remote),
Body: file,
ContentType: aws.String(contentType),
ACL: aws.String(access),
ACL: aws.String(acl),
Metadata: metadata,
}
@ -305,11 +347,13 @@ func (a *AWS) Upload(local, remote string) error {
}
_, err = a.client.PutObject(putObject)
return err
}
func (a *AWS) Redirect(path, location string) error {
p := a.plugin
plugin := a.plugin
logrus.Debugf("adding redirect from '%s' to '%s'", path, location)
if a.plugin.settings.DryRun {
@ -317,16 +361,18 @@ func (a *AWS) Redirect(path, location string) error {
}
_, err := a.client.PutObject(&s3.PutObjectInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(path),
ACL: aws.String("public-read"),
WebsiteRedirectLocation: aws.String(location),
})
return err
}
func (a *AWS) Delete(remote string) error {
p := a.plugin
plugin := a.plugin
logrus.Debugf("removing remote file '%s'", remote)
if a.plugin.settings.DryRun {
@ -334,17 +380,20 @@ func (a *AWS) Delete(remote string) error {
}
_, err := a.client.DeleteObject(&s3.DeleteObjectInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Key: aws.String(remote),
})
return err
}
func (a *AWS) List(path string) ([]string, error) {
p := a.plugin
remote := make([]string, 1)
plugin := a.plugin
remote := make([]string, 0)
resp, err := a.client.ListObjects(&s3.ListObjectsInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Prefix: aws.String(path),
})
if err != nil {
@ -357,7 +406,7 @@ func (a *AWS) List(path string) ([]string, error) {
for *resp.IsTruncated {
resp, err = a.client.ListObjects(&s3.ListObjectsInput{
Bucket: aws.String(p.settings.Bucket),
Bucket: aws.String(plugin.settings.Bucket),
Prefix: aws.String(path),
Marker: aws.String(remote[len(remote)-1]),
})
@ -376,7 +425,9 @@ func (a *AWS) List(path string) ([]string, error) {
func (a *AWS) Invalidate(invalidatePath string) error {
p := a.plugin
logrus.Debugf("invalidating '%s'", invalidatePath)
_, err := a.cfClient.CreateInvalidation(&cloudfront.CreateInvalidationInput{
DistributionId: aws.String(p.settings.CloudFrontDistribution),
InvalidationBatch: &cloudfront.InvalidationBatch{
@ -389,5 +440,6 @@ func (a *AWS) Invalidate(invalidatePath string) error {
},
},
})
return err
}

View File

@ -19,7 +19,7 @@ type Settings struct {
Source string
Target string
Delete bool
Access map[string]string
ACL map[string]string
CacheControl map[string]string
ContentType map[string]string
ContentEncoding map[string]string
@ -44,18 +44,13 @@ type Result struct {
err error
}
var MissingAwsValuesMessage = "Must set 'bucket'"
// Validate handles the settings validation of the plugin.
func (p *Plugin) Validate() error {
if len(p.settings.Bucket) == 0 {
return fmt.Errorf("no bucket name provided")
}
wd, err := os.Getwd()
if err != nil {
return fmt.Errorf("error while retrieving working directory: %w", err)
}
p.settings.Source = filepath.Join(wd, p.settings.Source)
p.settings.Target = strings.TrimPrefix(p.settings.Target, "/")
@ -92,7 +87,7 @@ func (p *Plugin) createSyncJobs() error {
return err
}
local := make([]string, 1)
local := make([]string, 0)
err = filepath.Walk(p.settings.Source, func(path string, info os.FileInfo, err error) error {
if err != nil || info.IsDir() {
@ -126,13 +121,16 @@ func (p *Plugin) createSyncJobs() error {
action: "redirect",
})
}
if p.settings.Delete {
for _, r := range remote {
for _, remote := range remote {
found := false
rPath := strings.TrimPrefix(r, p.settings.Target+"/")
remotePath := strings.TrimPrefix(remote, p.settings.Target+"/")
for _, l := range local {
if l == rPath {
if l == remotePath {
found = true
break
}
}
@ -140,7 +138,7 @@ func (p *Plugin) createSyncJobs() error {
if !found {
p.settings.Jobs = append(p.settings.Jobs, Job{
local: "",
remote: r,
remote: remote,
action: "delete",
})
}
@ -154,41 +152,46 @@ func (p *Plugin) runJobs() error {
client := p.settings.Client
jobChan := make(chan struct{}, p.settings.MaxConcurrency)
results := make(chan *Result, len(p.settings.Jobs))
var invalidateJob *Job
logrus.Infof("Synchronizing with bucket '%s'", p.settings.Bucket)
for _, j := range p.settings.Jobs {
for _, job := range p.settings.Jobs {
jobChan <- struct{}{}
go func(j Job) {
go func(job Job) {
var err error
switch j.action {
switch job.action {
case "upload":
err = client.Upload(j.local, j.remote)
err = client.Upload(job.local, job.remote)
case "redirect":
err = client.Redirect(j.local, j.remote)
err = client.Redirect(job.local, job.remote)
case "delete":
err = client.Delete(j.remote)
err = client.Delete(job.remote)
case "invalidateCloudFront":
invalidateJob = &j
invalidateJob = &job
default:
err = nil
}
results <- &Result{j, err}
results <- &Result{job, err}
<-jobChan
}(j)
}(job)
}
for range p.settings.Jobs {
r := <-results
if r.err != nil {
return fmt.Errorf("failed to %s %s to %s: %+v", r.j.action, r.j.local, r.j.remote, r.err)
return fmt.Errorf("failed to %s %s to %s: %w", r.j.action, r.j.local, r.j.remote, r.err)
}
}
if invalidateJob != nil {
err := client.Invalidate(invalidateJob.remote)
if err != nil {
return fmt.Errorf("failed to %s %s to %s: %+v", invalidateJob.action, invalidateJob.local, invalidateJob.remote, err)
return fmt.Errorf("failed to %s %s to %s: %w", invalidateJob.action, invalidateJob.local, invalidateJob.remote, err)
}
}

View File

@ -1,7 +1,7 @@
package plugin
import (
"github.com/thegeeklab/drone-plugin-lib/drone"
"github.com/thegeeklab/drone-plugin-lib/v2/drone"
)
// Plugin implements drone.Plugin to provide the plugin implementation.
@ -12,7 +12,7 @@ type Plugin struct {
}
// New initializes a plugin from the given Settings, Pipeline, and Network.
func New(settings Settings, pipeline drone.Pipeline, network drone.Network) drone.Plugin {
func New(settings Settings, pipeline drone.Pipeline, network drone.Network) *Plugin {
return &Plugin{
settings: settings,
pipeline: pipeline,

View File

@ -1,4 +0,0 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>thegeeklab/renovate-presets:golang"]
}