2022-07-31 15:07:18 +00:00
|
|
|
tasks:
|
|
|
|
- name: Server
|
|
|
|
env:
|
|
|
|
WOODPECKER_OPEN: true
|
|
|
|
WOODPECKER_ADMIN: woodpecker
|
|
|
|
WOODPECKER_HOST: http://host.docker.internal:8000
|
2024-01-02 09:48:40 +00:00
|
|
|
WOODPECKER_AGENT_SECRET: '1234'
|
2022-07-31 15:07:18 +00:00
|
|
|
WOODPECKER_GITEA: true
|
|
|
|
WOODPECKER_DEV_WWW_PROXY: http://localhost:8010
|
|
|
|
WOODPECKER_BACKEND_DOCKER_NETWORK: ci_default
|
|
|
|
init: |
|
2023-12-19 19:27:08 +00:00
|
|
|
GO_VERSION=1.21.5
|
|
|
|
rm -rf ~/go
|
2023-07-07 05:04:34 +00:00
|
|
|
curl -fsSL https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz | tar xzs -C ~/
|
2022-07-31 15:07:18 +00:00
|
|
|
go mod tidy
|
|
|
|
mkdir -p web/dist
|
|
|
|
touch web/dist/index.html
|
2022-10-21 16:59:30 +00:00
|
|
|
make build-server
|
2022-10-07 22:13:19 +00:00
|
|
|
command: |
|
2022-11-15 08:18:11 +00:00
|
|
|
grep "WOODPECKER_GITEA_URL=" .env \
|
|
|
|
&& sed "s,^WOODPECKER_GITEA_URL=.*,WOODPECKER_GITEA_URL=$(gp url 3000)," .env \
|
|
|
|
|| echo WOODPECKER_GITEA_URL=$(gp url 3000) >> .env
|
|
|
|
grep "WOODPECKER_DEV_OAUTH_HOST=" .env \
|
|
|
|
&& sed "s,^WOODPECKER_DEV_OAUTH_HOST=.*,WOODPECKER_DEV_OAUTH_HOST=$(gp url 8000)," .env \
|
|
|
|
|| echo WOODPECKER_DEV_OAUTH_HOST=$(gp url 8000) >> .env
|
2022-07-31 15:07:18 +00:00
|
|
|
gp sync-await gitea
|
|
|
|
gp sync-done woodpecker-server
|
2023-12-08 07:15:08 +00:00
|
|
|
go run go.woodpecker-ci.org/woodpecker/v2/cmd/server
|
2022-07-31 15:07:18 +00:00
|
|
|
- name: Agent
|
|
|
|
env:
|
|
|
|
WOODPECKER_SERVER: localhost:9000
|
2024-01-02 09:48:40 +00:00
|
|
|
WOODPECKER_AGENT_SECRET: '1234'
|
2022-10-28 15:38:53 +00:00
|
|
|
WOODPECKER_MAX_WORKFLOWS: 1
|
2022-07-31 15:07:18 +00:00
|
|
|
WOODPECKER_HEALTHCHECK: false
|
2022-10-07 22:13:19 +00:00
|
|
|
command: |
|
2022-07-31 15:07:18 +00:00
|
|
|
gp sync-await woodpecker-server
|
2023-12-08 07:15:08 +00:00
|
|
|
go run go.woodpecker-ci.org/woodpecker/v2/cmd/agent
|
2022-07-31 15:07:18 +00:00
|
|
|
- name: Gitea
|
|
|
|
command: |
|
2024-01-11 17:43:54 +00:00
|
|
|
export DOCKER_COMPOSE_CMD="docker-compose -f docker-compose.gitpod.yaml -p woodpecker"
|
2022-07-31 15:07:18 +00:00
|
|
|
export GITEA_CLI_CMD="$DOCKER_COMPOSE_CMD exec -u git gitea gitea"
|
|
|
|
$DOCKER_COMPOSE_CMD up -d
|
2022-11-04 00:52:56 +00:00
|
|
|
until curl --output /dev/null --silent --head --fail http://localhost:3000; do printf '.'; sleep 1; done
|
2022-07-31 15:07:18 +00:00
|
|
|
$GITEA_CLI_CMD admin user create --username woodpecker --password password --email woodpecker@localhost --admin
|
2024-01-30 17:39:59 +00:00
|
|
|
export GITEA_TOKEN=$($GITEA_CLI_CMD admin user generate-access-token -u woodpecker --scopes write:repository,write:user --raw | tail -n 1 | awk 'NF{ print $NF }')
|
2022-07-31 15:07:18 +00:00
|
|
|
GITEA_OAUTH_APP=$(curl -X 'POST' 'http://localhost:3000/api/v1/user/applications/oauth2' \
|
|
|
|
-H 'accept: application/json' -H 'Content-Type: application/json' -H "Authorization: token ${GITEA_TOKEN}" \
|
2022-10-26 14:54:42 +00:00
|
|
|
-d "{ \"name\": \"Woodpecker CI\", \"confidential_client\": true, \"redirect_uris\": [ \"https://8000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}/authorize\" ] }")
|
2024-01-30 17:39:59 +00:00
|
|
|
touch .env
|
2022-11-15 08:18:11 +00:00
|
|
|
grep "WOODPECKER_GITEA_CLIENT=" .env \
|
|
|
|
&& sed "s,^WOODPECKER_GITEA_CLIENT=.*,WOODPECKER_GITEA_CLIENT=$(echo $GITEA_OAUTH_APP | jq -r .client_id)," .env \
|
|
|
|
|| echo WOODPECKER_GITEA_CLIENT=$(echo $GITEA_OAUTH_APP | jq -r .client_id) >> .env
|
|
|
|
grep "WOODPECKER_GITEA_SECRET=" .env \
|
|
|
|
&& sed "s,^WOODPECKER_GITEA_SECRET=.*,WOODPECKER_GITEA_SECRET=$(echo $GITEA_OAUTH_APP | jq -r .client_secret)," .env \
|
|
|
|
|| echo WOODPECKER_GITEA_SECRET=$(echo $GITEA_OAUTH_APP | jq -r .client_secret) >> .env
|
2022-10-09 20:13:04 +00:00
|
|
|
curl -X 'POST' \
|
|
|
|
'http://localhost:3000/api/v1/user/repos' \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
|
|
-d '{ "auto_init": false, "name": "woodpecker-test", "private": true, "template": false, "trust_model": "default" }'
|
|
|
|
cd contrib/woodpecker-test-repo
|
|
|
|
git init
|
|
|
|
git checkout -b main
|
|
|
|
git remote add origin http://woodpecker:${GITEA_TOKEN}@localhost:3000/woodpecker/woodpecker-test.git
|
|
|
|
git add .
|
2024-01-27 20:15:10 +00:00
|
|
|
git commit -m "Initial commit"
|
2022-10-09 20:13:04 +00:00
|
|
|
git push -u origin main
|
2023-03-11 06:08:00 +00:00
|
|
|
cd ../..
|
2022-07-31 15:07:18 +00:00
|
|
|
gp sync-done gitea
|
|
|
|
$DOCKER_COMPOSE_CMD logs -f
|
|
|
|
- name: App
|
2022-10-07 23:03:13 +00:00
|
|
|
before: |
|
2022-07-31 15:07:18 +00:00
|
|
|
cd web/
|
2022-10-07 23:03:13 +00:00
|
|
|
init: |
|
2022-10-08 14:15:07 +00:00
|
|
|
pnpm install
|
2022-10-07 23:03:13 +00:00
|
|
|
command: |
|
2022-10-08 14:15:07 +00:00
|
|
|
pnpm start
|
2022-07-31 15:07:18 +00:00
|
|
|
- name: Docs
|
2022-10-07 23:03:13 +00:00
|
|
|
before: |
|
2022-07-31 15:07:18 +00:00
|
|
|
cd docs/
|
2022-10-07 23:03:13 +00:00
|
|
|
init: |
|
2022-10-08 14:15:07 +00:00
|
|
|
pnpm install
|
|
|
|
pnpm build:woodpecker-plugins
|
2022-10-07 23:03:13 +00:00
|
|
|
command: |
|
2022-10-08 14:15:07 +00:00
|
|
|
pnpm start --port 4000
|
2022-07-31 15:07:18 +00:00
|
|
|
|
|
|
|
ports:
|
|
|
|
- port: 3000
|
2022-10-28 11:10:45 +00:00
|
|
|
name: Gitea
|
2022-07-31 15:07:18 +00:00
|
|
|
onOpen: ignore
|
|
|
|
visibility: public # TODO: https://github.com/woodpecker-ci/woodpecker/issues/856
|
|
|
|
- port: 8000
|
2022-10-28 11:10:45 +00:00
|
|
|
name: Woodpecker
|
2022-07-31 15:07:18 +00:00
|
|
|
onOpen: notify
|
|
|
|
visibility: public # TODO: https://github.com/woodpecker-ci/woodpecker/issues/856
|
|
|
|
- port: 9000
|
2022-10-28 11:10:45 +00:00
|
|
|
name: Woodpecker GRPC
|
2022-07-31 15:07:18 +00:00
|
|
|
onOpen: ignore
|
|
|
|
- port: 8010
|
2022-10-28 11:10:45 +00:00
|
|
|
description: Do not use! Access woodpecker on port 8000
|
2022-07-31 15:07:18 +00:00
|
|
|
onOpen: ignore
|
|
|
|
- port: 4000
|
2022-10-28 11:10:45 +00:00
|
|
|
name: Docs
|
2022-07-31 15:07:18 +00:00
|
|
|
onOpen: notify
|
|
|
|
|
|
|
|
vscode:
|
|
|
|
extensions:
|
2024-01-27 20:15:10 +00:00
|
|
|
# cSpell:disable
|
2023-07-07 05:04:34 +00:00
|
|
|
- 'golang.go'
|
|
|
|
- 'EditorConfig.EditorConfig'
|
|
|
|
- 'dbaeumer.vscode-eslint'
|
|
|
|
- 'esbenp.prettier-vscode'
|
|
|
|
- 'voorjaar.windicss-intellisense'
|
|
|
|
- 'Vue.volar'
|
|
|
|
- 'redhat.vscode-yaml'
|
|
|
|
- 'davidanson.vscode-markdownlint'
|
|
|
|
- 'streetsidesoftware.code-spell-checker'
|
2024-01-27 20:15:10 +00:00
|
|
|
# cSpell:enable
|