feat: init woodpecker #1
4 changed files with 28 additions and 9 deletions
|
@ -1,4 +1,16 @@
|
||||||
steps:
|
steps:
|
||||||
|
setup:
|
||||||
|
image: python
|
||||||
|
when:
|
||||||
|
event: [push, pull_request, tag, deployment]
|
||||||
|
environment:
|
||||||
|
POSTGRES_DATABASE_URL: postgres://postgres:password@database:5432/postgres
|
||||||
|
commands:
|
||||||
|
- pip install requests
|
||||||
|
- sed -i 's/localhost/forgejo/' scripts/gitea.py
|
||||||
|
- python ./scripts/gitea.py
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
image: rust
|
image: rust
|
||||||
when:
|
when:
|
||||||
|
@ -17,7 +29,7 @@ steps:
|
||||||
- make migrate
|
- make migrate
|
||||||
- make
|
- make
|
||||||
# - make lint
|
# - make lint
|
||||||
- make test
|
- make test.workspaces
|
||||||
|
|
||||||
|
|
||||||
build_docker_img:
|
build_docker_img:
|
||||||
|
@ -30,6 +42,9 @@ steps:
|
||||||
tags: latest
|
tags: latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
forgejo:
|
||||||
|
image: codeberg.org/forgejo/forgejo:9
|
||||||
|
|
||||||
database:
|
database:
|
||||||
image: postgres
|
image: postgres
|
||||||
environment:
|
environment:
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -131,6 +131,10 @@ test: migrate ## Run tests
|
||||||
$(call cache_bust)
|
$(call cache_bust)
|
||||||
$(call test_workspaces)
|
$(call test_workspaces)
|
||||||
|
|
||||||
|
test.workspaces:
|
||||||
|
$(call cache_bust)
|
||||||
|
$(call test_workspaces)
|
||||||
|
|
||||||
# cd database/db-sqlx-postgres &&\
|
# cd database/db-sqlx-postgres &&\
|
||||||
# DATABASE_URL=${POSTGRES_DATABASE_URL}\
|
# DATABASE_URL=${POSTGRES_DATABASE_URL}\
|
||||||
# cargo test --no-fail-fast
|
# cargo test --no-fail-fast
|
||||||
|
|
|
@ -19,5 +19,5 @@ services:
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
ports:
|
ports:
|
||||||
- "8080:3000"
|
- "3000:3000"
|
||||||
- "2221:22"
|
- "2221:22"
|
||||||
|
|
|
@ -20,7 +20,7 @@ def check_online():
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
res = requests.get(
|
res = requests.get(
|
||||||
"http://localhost:8080/api/v1/nodeinfo", allow_redirects=False
|
"http://localhost:3000/api/v1/nodeinfo", allow_redirects=False
|
||||||
)
|
)
|
||||||
if any([res.status_code == 302, res.status_code == 200]):
|
if any([res.status_code == 302, res.status_code == 200]):
|
||||||
break
|
break
|
||||||
|
@ -49,7 +49,7 @@ def install():
|
||||||
"domain": "localhost",
|
"domain": "localhost",
|
||||||
"ssh_port": "2221",
|
"ssh_port": "2221",
|
||||||
"http_port": "3000",
|
"http_port": "3000",
|
||||||
"app_url": "http://localhost:8080/",
|
"app_url": "http://localhost:3000/",
|
||||||
"log_root_path": "/data/gitea/log",
|
"log_root_path": "/data/gitea/log",
|
||||||
"smtp_host": "",
|
"smtp_host": "",
|
||||||
"smtp_from": "",
|
"smtp_from": "",
|
||||||
|
@ -67,7 +67,7 @@ def install():
|
||||||
"admin_confirm_passwd": "",
|
"admin_confirm_passwd": "",
|
||||||
"admin_email": "",
|
"admin_email": "",
|
||||||
}
|
}
|
||||||
requests.post(f"http://localhost:8080", data=INSTALL_PAYLOAD)
|
requests.post(f"http://localhost:3000", data=INSTALL_PAYLOAD)
|
||||||
|
|
||||||
|
|
||||||
class ParseCSRFGiteaForm(HTMLParser):
|
class ParseCSRFGiteaForm(HTMLParser):
|
||||||
|
@ -118,7 +118,7 @@ class HTMLClient:
|
||||||
|
|
||||||
|
|
||||||
def register(client: HTMLClient):
|
def register(client: HTMLClient):
|
||||||
url = "http://localhost:8080/user/sign_up"
|
url = "http://localhost:3000/user/sign_up"
|
||||||
csrf = client.get_csrf_token(url)
|
csrf = client.get_csrf_token(url)
|
||||||
payload = {
|
payload = {
|
||||||
"_csrf": csrf,
|
"_csrf": csrf,
|
||||||
|
@ -131,7 +131,7 @@ def register(client: HTMLClient):
|
||||||
|
|
||||||
|
|
||||||
def login(client: HTMLClient):
|
def login(client: HTMLClient):
|
||||||
url = "http://localhost:8080/user/login"
|
url = "http://localhost:3000/user/login"
|
||||||
csrf = client.get_csrf_token(url)
|
csrf = client.get_csrf_token(url)
|
||||||
payload = {
|
payload = {
|
||||||
"_csrf": csrf,
|
"_csrf": csrf,
|
||||||
|
@ -167,7 +167,7 @@ def create_repositories(client: HTMLClient):
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
|
|
||||||
url = "http://localhost:8080/repo/create"
|
url = "http://localhost:3000/repo/create"
|
||||||
for repo in REPOS:
|
for repo in REPOS:
|
||||||
csrf = client.get_csrf_token(url)
|
csrf = client.get_csrf_token(url)
|
||||||
resp = client.session.post(url, data=get_repository_payload(csrf, repo))
|
resp = client.session.post(url, data=get_repository_payload(csrf, repo))
|
||||||
|
@ -182,7 +182,7 @@ def create_repositories(client: HTMLClient):
|
||||||
def add_tag(repo: str, client: HTMLClient):
|
def add_tag(repo: str, client: HTMLClient):
|
||||||
print("adding tags")
|
print("adding tags")
|
||||||
tag = "testing"
|
tag = "testing"
|
||||||
url = f"http://{GITEA_USER}:{GITEA_PASSWORD}@localhost:8080/api/v1/repos/{GITEA_USER}/{repo}/topics/{tag}"
|
url = f"http://{GITEA_USER}:{GITEA_PASSWORD}@localhost:3000/api/v1/repos/{GITEA_USER}/{repo}/topics/{tag}"
|
||||||
resp = requests.put(url)
|
resp = requests.put(url)
|
||||||
if resp.status_code != 204:
|
if resp.status_code != 204:
|
||||||
print(f"Error while adding tags repository: {repo} {resp.status_code}")
|
print(f"Error while adding tags repository: {repo} {resp.status_code}")
|
||||||
|
|
Loading…
Reference in a new issue