Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try using s3 cache #3812

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 50 additions & 8 deletions .woodpecker/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,27 @@ when:
evaluate: 'TASK == "docs"'

steps:
build-cli:
- name: download cache
image: anbraten/s3cache
pull: true
settings:
mode: download
paths:
- docs/node_modules
- docs/.docusaurus
- docs/build
- docs/plugins/woodpecker-plugins/dist
- docs/plugins/woodpecker-plugins/node_modules
endpoint: s3.ju60.de
bucket: test
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
when:
- event: pull_request

- name: build-cli
image: *golang_image
commands:
- make docs
Expand All @@ -47,7 +67,7 @@ steps:
event: [tag, pull_request, push]
- event: manual

build:
- name: build
image: *node_image
directory: docs/
commands:
Expand All @@ -59,7 +79,7 @@ steps:
event: [tag, pull_request, push]
- event: manual

deploy-preview:
- name: deploy-preview
image: docker.io/woodpeckerci/plugin-surge-preview:1.3.0
settings:
path: 'docs/build/'
Expand All @@ -72,7 +92,7 @@ steps:
event: [pull_request, pull_request_closed]
path: *when_path

deploy-prepare:
- name: deploy-prepare
image: *alpine_image
secrets:
- BOT_PRIVATE_KEY
Expand All @@ -92,7 +112,7 @@ steps:
- event: [manual, tag]

# update latest and next version
version-next:
- name: version-next
image: *alpine_image
commands:
- apk add jq
Expand All @@ -103,7 +123,7 @@ steps:
path: *docker_path
branch: ${CI_REPO_DEFAULT_BRANCH}

version-release:
- name: version-release
image: *alpine_image
commands:
- apk add jq
Expand All @@ -113,7 +133,7 @@ steps:
when:
- event: tag

copy-files:
- name: copy-files
image: *alpine_image
commands:
- apk add rsync
Expand All @@ -125,7 +145,7 @@ steps:
branch: ${CI_REPO_DEFAULT_BRANCH}
- event: manual

deploy:
- name: deploy
image: *alpine_image
secrets:
- BOT_PRIVATE_KEY
Expand All @@ -150,3 +170,25 @@ steps:
- <<: *docker_path
branch: ${CI_REPO_DEFAULT_BRANCH}
- event: [manual, tag]

- name: upload cache
image: plugins/s3-cache
pull: true
settings:
mode: rebuild
mount:
- docs/node_modules
- docs/.docusaurus
- docs/build
- docs/plugins/woodpecker-plugins/dist
- docs/plugins/woodpecker-plugins/node_modules
endpoint: s3.ju60.de
bucket: test
access_key:
from_secret: s3_access_key
secret_key:
from_secret: s3_secret_key
restore: true
filename: cache-${CI_REPO}.tar
when:
- event: push
64 changes: 41 additions & 23 deletions .woodpecker/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,65 +23,80 @@ when:
path: *when_path

steps:
vendor:
- name: vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
commands:
- mkdir -p .go
- go mod vendor
- ls -la vendor
when:
path:
- <<: *when_path
- '.woodpecker/**'

lint-pipeline:
- name: lint-pipeline
image: *golang_image
depends_on:
- vendor
image: *golang_image
commands:
- go run go.woodpecker-ci.org/woodpecker/v2/cmd/cli lint
environment:
GOPATH: ${CI_WORKSPACE}/.go
WOODPECKER_DISABLE_UPDATE_CHECK: true
commands:
- go run go.woodpecker-ci.org/woodpecker/v2/cmd/cli lint
when:
- event: pull_request
path:
- '.woodpecker/**'

dummy-web:
- name: dummy-web
image: *golang_image
commands:
- mkdir -p web/dist/
- echo "test" > web/dist/index.html
when:
- path: *when_path

lint:
- name: lint
image: *golang_image
depends_on:
- vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
commands:
- make lint
when: *when

check-swagger:
- name: check-swagger
image: *golang_image
depends_on:
- vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
commands:
- 'make generate-swagger'
- 'DIFF=$(git diff | head)'
- '[ -n "$DIFF" ] && { echo "swagger not up to date, exec `make generate-swagger` and commit"; exit 1; } || true'
when: *when

lint-license-header:
- name: lint-license-header
image: *golang_image
depends_on:
- vendor
environment:
GOPATH: ${CI_WORKSPACE}/.go
commands:
- go install github.com/google/addlicense@latest # cspell:words addlicense
- 'addlicense -check -ignore "vendor/**" **/*.go'
when: *when

test:
- name: test
image: *golang_image
depends_on:
- vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
commands:
- make test-agent
- make test-server
Expand All @@ -90,45 +105,48 @@ steps:
when:
- path: *when_path

sqlite:
- name: sqlite
image: *golang_image
depends_on:
- vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
WOODPECKER_DATABASE_DRIVER: sqlite3
commands:
- make test-server-datastore-coverage
when:
- path: *when_path

postgres:
- name: postgres
image: *golang_image
depends_on:
- vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
WOODPECKER_DATABASE_DRIVER: postgres
WOODPECKER_DATABASE_DATASOURCE: 'host=postgres user=postgres dbname=postgres sslmode=disable' # cspell:disable-line
commands:
- make test-server-datastore
when: *when

mysql:
- name: mysql
image: *golang_image
depends_on:
- vendor
image: *golang_image
environment:
GOPATH: ${CI_WORKSPACE}/.go
WOODPECKER_DATABASE_DRIVER: mysql
WOODPECKER_DATABASE_DATASOURCE: root@tcp(mysql:3306)/test?parseTime=true
commands:
- make test-server-datastore
when: *when

codecov:
- name: codecov
image: docker.io/woodpeckerci/plugin-codecov:2.1.2
depends_on:
- test
- sqlite
pull: true
image: docker.io/woodpeckerci/plugin-codecov:2.1.2
settings:
files:
- agent-coverage.out
Expand All @@ -143,15 +161,15 @@ steps:
failure: ignore

services:
postgres:
- name: postgres
image: docker.io/postgres:16
ports: ['5432']
environment:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
when: *when

mysql:
- name: mysql
image: docker.io/mysql:8.2.0
ports: ['3306']
environment:
Expand Down