|
| 1 | +--- |
| 2 | + |
| 3 | +# This is an example of a Drone pipeline that can be run locally |
| 4 | +kind: pipeline |
| 5 | +name: local-pipeline |
| 6 | + |
| 7 | +platform: |
| 8 | + os: linux |
| 9 | + arch: amd64 |
| 10 | + |
| 11 | +clone: |
| 12 | + depth: 50 |
| 13 | + |
| 14 | +steps: |
| 15 | + # This is needed for the tags. And the tags are needed to determine version. |
| 16 | + - name: fetch |
| 17 | + image: docker:git |
| 18 | + commands: |
| 19 | + - git fetch --tags -f |
| 20 | + |
| 21 | + - name: configure-buckets |
| 22 | + image: minio/mc:RELEASE.2020-10-03T02-54-56Z |
| 23 | + commands: |
| 24 | + - sleep 5 |
| 25 | + - mc config host add minio http://minio:9000 AKIAIOSFODNN7EXAMPLE wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 26 | + - mc mb --region=eu-west-1 minio/drone-cache-bucket |
| 27 | + - mc admin user add minio foo barbarbar |
| 28 | + - "echo '{\"Version\": \"2012-10-17\", \"Statement\": [ { \"Action\": [ \"s3:GetObject\", \"s3:PutObject\", \"s3:DeleteObject\", \"s3:CreateBucket\", \"s3:DeleteBucket\" ], \"Effect\": \"Allow\", \"Resource\": [ \"arn:aws:s3:::s3-round-trip-with-role/*\", \"arn:aws:s3:::s3-round-trip-with-role\" ], \"Sid\": \"\" } ] }' >> /tmp/policy.json" |
| 29 | + - mc admin policy add minio userpolicy /tmp/policy.json |
| 30 | + - mc admin policy set minio userpolicy user=foo |
| 31 | + |
| 32 | + - name: build |
| 33 | + image: golang:1.14.4-alpine3.12 |
| 34 | + commands: |
| 35 | + - apk add --update make git |
| 36 | + - make drone-cache |
| 37 | + environment: |
| 38 | + CGO_ENABLED: 0 |
| 39 | + |
| 40 | + - name: lint |
| 41 | + image: golang:1.14.4-alpine3.12 |
| 42 | + commands: |
| 43 | + - apk add --update make git curl |
| 44 | + - make lint |
| 45 | + environment: |
| 46 | + CGO_ENABLED: 0 |
| 47 | + |
| 48 | + - name: test |
| 49 | + image: golang:1.14.4-alpine3.12 |
| 50 | + commands: |
| 51 | + - go test -mod=vendor -short -cover -tags=integration ./... |
| 52 | + environment: |
| 53 | + CGO_ENABLED: 0 |
| 54 | + TEST_S3_ENDPOINT: minio:9000 |
| 55 | + TEST_GCS_ENDPOINT: http://fakegcs:4443/storage/v1/ |
| 56 | + TEST_STORAGE_EMULATOR_HOST: fakegcs:4443 |
| 57 | + TEST_SFTP_HOST: sftp |
| 58 | + TEST_AZURITE_URL: azurite:10000 |
| 59 | + volumes: |
| 60 | + - name: testdata |
| 61 | + path: /drone/src/tmp/testdata/cache |
| 62 | + |
| 63 | + - name: rebuild-cache |
| 64 | + image: drone-cache:MyTestTag |
| 65 | + pull: if-not-exists |
| 66 | + settings: |
| 67 | + bucket: drone-cache-bucket |
| 68 | + mount: |
| 69 | + - vendor |
| 70 | + rebuild: true |
| 71 | + region: eu-west-1 |
| 72 | + path_style: true |
| 73 | + endpoint: minio:9000 |
| 74 | + exit_code: true |
| 75 | + environment: |
| 76 | + AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE |
| 77 | + AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 78 | + |
| 79 | + - name: rebuild-cache-with-key |
| 80 | + image: drone-cache:MyTestTag |
| 81 | + pull: if-not-exists |
| 82 | + settings: |
| 83 | + bucket: drone-cache-bucket |
| 84 | + cache_key: "{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}" |
| 85 | + mount: |
| 86 | + - vendor |
| 87 | + rebuild: true |
| 88 | + region: eu-west-1 |
| 89 | + path_style: true |
| 90 | + endpoint: minio:9000 |
| 91 | + exit_code: true |
| 92 | + environment: |
| 93 | + AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE |
| 94 | + AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 95 | + |
| 96 | + - name: rebuild-cache-with-gzip |
| 97 | + image: drone-cache:MyTestTag |
| 98 | + pull: if-not-exists |
| 99 | + settings: |
| 100 | + archive_format: gzip |
| 101 | + bucket: drone-cache-bucket |
| 102 | + cache_key: gzip |
| 103 | + mount: |
| 104 | + - vendor |
| 105 | + rebuild: true |
| 106 | + region: eu-west-1 |
| 107 | + path_style: true |
| 108 | + endpoint: minio:9000 |
| 109 | + exit_code: true |
| 110 | + environment: |
| 111 | + AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE |
| 112 | + AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 113 | + |
| 114 | + - name: rebuild-cache-with-filesystem |
| 115 | + image: drone-cache:MyTestTag |
| 116 | + pull: if-not-exists |
| 117 | + settings: |
| 118 | + archive_format: gzip |
| 119 | + backend: filesystem |
| 120 | + cache_key: volume |
| 121 | + mount: |
| 122 | + - vendor |
| 123 | + rebuild: true |
| 124 | + exit_code: true |
| 125 | + volumes: |
| 126 | + - name: cache |
| 127 | + path: /tmp/cache |
| 128 | + |
| 129 | + - name: restore-cache-with-key |
| 130 | + image: drone-cache:MyTestTag |
| 131 | + pull: if-not-exists |
| 132 | + settings: |
| 133 | + bucket: drone-cache-bucket |
| 134 | + cache_key: "{{ .Repo.Name }}_{{ checksum \"go.mod\" }}_{{ checksum \"go.sum\" }}_{{ arch }}_{{ os }}" |
| 135 | + mount: |
| 136 | + - vendor |
| 137 | + region: eu-west-1 |
| 138 | + pull: always |
| 139 | + restore: true |
| 140 | + path_style: true |
| 141 | + endpoint: minio:9000 |
| 142 | + exit_code: true |
| 143 | + environment: |
| 144 | + AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE |
| 145 | + AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 146 | + |
| 147 | + - name: restore-cache-with-gzip |
| 148 | + image: drone-cache:MyTestTag |
| 149 | + pull: if-not-exists |
| 150 | + settings: |
| 151 | + archive_format: gzip |
| 152 | + bucket: drone-cache-bucket |
| 153 | + cache_key: gzip |
| 154 | + mount: |
| 155 | + - vendor |
| 156 | + region: eu-west-1 |
| 157 | + restore: true |
| 158 | + path_style: true |
| 159 | + endpoint: minio:9000 |
| 160 | + exit_code: true |
| 161 | + environment: |
| 162 | + AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE |
| 163 | + AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 164 | + |
| 165 | + - name: restore-cache-with-filesystem |
| 166 | + image: drone-cache:MyTestTag |
| 167 | + pull: if-not-exists |
| 168 | + settings: |
| 169 | + archive_format: gzip |
| 170 | + backend: filesystem |
| 171 | + cache_key: volume |
| 172 | + mount: |
| 173 | + - vendor |
| 174 | + restore: true |
| 175 | + exit_code: true |
| 176 | + volumes: |
| 177 | + - name: cache |
| 178 | + path: /tmp/cache |
| 179 | + |
| 180 | + - name: restore-cache-debug |
| 181 | + image: drone-cache:MyTestTag |
| 182 | + pull: if-not-exists |
| 183 | + settings: |
| 184 | + debug: true |
| 185 | + restore: true |
| 186 | + pull: always |
| 187 | + |
| 188 | + - name: restore-cache |
| 189 | + image: drone-cache:MyTestTag |
| 190 | + pull: if-not-exists |
| 191 | + settings: |
| 192 | + bucket: drone-cache-bucket |
| 193 | + mount: |
| 194 | + - vendor |
| 195 | + region: eu-west-1 |
| 196 | + restore: true |
| 197 | + path_style: true |
| 198 | + endpoint: minio:9000 |
| 199 | + exit_code: true |
| 200 | + environment: |
| 201 | + AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE |
| 202 | + AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 203 | + |
| 204 | +services: |
| 205 | + - name: minio |
| 206 | + image: minio/minio:RELEASE.2020-11-06T23-17-07Z |
| 207 | + commands: |
| 208 | + - minio server /data |
| 209 | + environment: |
| 210 | + MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE |
| 211 | + MINIO_REGION: eu-west-1 |
| 212 | + MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| 213 | + ports: |
| 214 | + - 9000 |
| 215 | + - name: fakegcs |
| 216 | + image: fsouza/fake-gcs-server:1.18.3 |
| 217 | + ports: |
| 218 | + - 4443 |
| 219 | + commands: |
| 220 | + - fake-gcs-server -public-host fakegcs -scheme http |
| 221 | + - name: sftp |
| 222 | + image: atmoz/sftp:alpine |
| 223 | + ports: |
| 224 | + - 22 |
| 225 | + commands: |
| 226 | + - /entrypoint foo:pass:::sftp_test bar:pass:::plugin_test |
| 227 | + - name: azurite |
| 228 | + image: mcr.microsoft.com/azure-storage/azurite:3.10.0 |
| 229 | + commands: |
| 230 | + - azurite-blob --blobHost 0.0.0.0 |
| 231 | + ports: |
| 232 | + - 10000 |
| 233 | + |
| 234 | +volumes: |
| 235 | + - name: cache |
| 236 | + temp: {} |
| 237 | + - name: testdata |
| 238 | + temp: {} |
| 239 | + |
| 240 | +trigger: |
| 241 | + branch: |
| 242 | + - master |
| 243 | + event: |
| 244 | + - |
| 245 | +... |
0 commit comments