diff --git a/test/config.json b/test/config.json new file mode 100644 index 0000000..8161cd1 --- /dev/null +++ b/test/config.json @@ -0,0 +1,12 @@ +{ + "lajuntament": { + "test": { + "secret": "elsecret", + "deploy_script": "./test/deploy.sh", + "env": { + "GIT_REPO_URL": "ssh://git@git.lajuntament.space:2222/lajuntament/web.git", + "GIT_SSH_ID_FILE": "/home/marc/.ssh/lajuntament.pub" + } + } + } +} diff --git a/test/deploy.sh b/test/deploy.sh new file mode 100755 index 0000000..a521c9f --- /dev/null +++ b/test/deploy.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +echo "Deploying for $GIT_REPO_URL" + +CONTENT_DIR=$(mktemp -d -t ci-XXXXXXXXXX) +echo "Working directory: ${CONTENT_DIR}" +mkdir -p ${CONTENT_DIR} + +GIT_SSH_COMMAND="ssh -oStrictHostKeyChecking=no -i ${GIT_SSH_ID_FILE}" git clone ${GIT_REPO_URL} ${CONTENT_DIR} + +# mkdir -p ${TARGET_DIR} +cd ${CONTENT_DIR} && hugo ${HUGO_PARAMS} +rm -rf ${CONTENT_DIR} diff --git a/test/msg.json b/test/msg.json new file mode 100644 index 0000000..8874c59 --- /dev/null +++ b/test/msg.json @@ -0,0 +1,106 @@ +{ + "ref": "refs/heads/main", + "before": "e2e236b3679daef3dce6174d15d416f9e32ab6de", + "after": "7f225fcab5f5bcbba5208d047abab2a560e8ad44", + "compare_url": "https://git.lajuntament.space/lajuntament/test/compare/e2e236b3679daef3dce6174d15d416f9e32ab6de...7f225fcab5f5bcbba5208d047abab2a560e8ad44", + "commits": [ + { + "id": "7f225fcab5f5bcbba5208d047abab2a560e8ad44", + "message": "Added signature check\n", + "url": "https://git.lajuntament.space/lajuntament/test/commit/7f225fcab5f5bcbba5208d047abab2a560e8ad44", + "author": { + "name": "L'Ajuntament", + "email": "git@lajuntament.space", + "username": "lajuntament" + }, + "committer": { + "name": "L'Ajuntament", + "email": "git@lajuntament.space", + "username": "lajuntament" + }, + "verification": null, + "timestamp": "2021-10-24T12:02:09+02:00", + "added": [], + "removed": [], + "modified": [ + "app.py" + ] + } + ], + "head_commit": { + "id": "7f225fcab5f5bcbba5208d047abab2a560e8ad44", + "message": "Added signature check\n", + "url": "https://git.lajuntament.space/lajuntament/test/commit/7f225fcab5f5bcbba5208d047abab2a560e8ad44", + "author": { + "name": "L'Ajuntament", + "email": "git@lajuntament.space", + "username": "lajuntament" + }, + "committer": { + "name": "L'Ajuntament", + "email": "git@lajuntament.space", + "username": "lajuntament" + }, + "verification": null, + "timestamp": "2021-10-24T12:02:09+02:00", + "added": [], + "removed": [], + "modified": [ + "app.py" + ] + }, + "repository": { + "id": 2, + "owner": {"id":1,"login":"lajuntament","full_name":"","email":"lajuntament@noreply.localhost","avatar_url":"https://git.lajuntament.space/user/avatar/lajuntament/-1","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2021-10-24T00:07:32Z","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"lajuntament"}, + "name": "test", + "full_name": "lajuntament/test", + "description": "Repo de proves", + "empty": false, + "private": true, + "fork": false, + "template": false, + "parent": null, + "mirror": false, + "size": 21, + "html_url": "https://git.lajuntament.space/lajuntament/test", + "ssh_url": "ssh://git@git.lajuntament.space:2222/lajuntament/test.git", + "clone_url": "https://git.lajuntament.space/lajuntament/test.git", + "original_url": "", + "website": "", + "stars_count": 0, + "forks_count": 0, + "watchers_count": 1, + "open_issues_count": 0, + "open_pr_counter": 0, + "release_counter": 0, + "default_branch": "main", + "archived": false, + "created_at": "2021-10-24T09:18:10Z", + "updated_at": "2021-10-24T09:58:40Z", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "has_issues": true, + "internal_tracker": { + "enable_time_tracker": true, + "allow_only_contributors_to_track_time": true, + "enable_issue_dependencies": true + }, + "has_wiki": true, + "has_pull_requests": true, + "has_projects": true, + "ignore_whitespace_conflicts": false, + "allow_merge_commits": true, + "allow_rebase": true, + "allow_rebase_explicit": true, + "allow_squash_merge": true, + "default_merge_style": "merge", + "avatar_url": "", + "internal": false, + "mirror_interval": "" + }, + "pusher": {"id":1,"login":"lajuntament","full_name":"","email":"lajuntament@noreply.localhost","avatar_url":"https://git.lajuntament.space/user/avatar/lajuntament/-1","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2021-10-24T00:07:32Z","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"lajuntament"}, + "sender": {"id":1,"login":"lajuntament","full_name":"","email":"lajuntament@noreply.localhost","avatar_url":"https://git.lajuntament.space/user/avatar/lajuntament/-1","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2021-10-24T00:07:32Z","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"lajuntament"} +} diff --git a/test/test.http b/test/test.http new file mode 100644 index 0000000..3f7a04f --- /dev/null +++ b/test/test.http @@ -0,0 +1,6 @@ +POST http://skaftafell:6000/lajuntament/test/deploy +Content-Type: application/json +X-Gitea-Event: push +X-Gitea-Signature: 2bb969b477b4a2e998328336a04714147e97077ed748fa9d277cab43c69af66e + +< msg.json