Compare commits

...
Author SHA1 Message Date
telackey 48c5456107 Fix hostname 2023-03-24 23:11:33 -05:00
telackey 5aa2bfcf8b Redirect output 2023-03-24 22:28:50 -05:00
telackey 1a9c3b4ae5 Add support for Gitea actions via act_runner. 2023-03-24 22:21:44 -05:00
dboreham 16ce2e9bb2 Merge pull request #18 from cerc-io/dboreham/gitea-enable-actions
Enable CI/Actions in Gitea
2023-03-20 14:00:01 -06:00
dboreham 4908d65971 Enable CI/Actions in Gitea 2023-03-20 13:59:00 -06:00
dboreham c7b53d2707 Merge pull request #17 from cerc-io/dboreham/fix-for-gitea-1-19
Add token scope for Gitea 1.9
2023-03-20 13:05:11 -06:00
dboreham d9a568ea47 Add token scope for Gitea 1.9 2023-03-20 13:00:50 -06:00
dboreham e136ead3c7 Merge pull request #14 from cerc-io/dboreham/update-gitea-1-9
Update to Gitea 1.9
2023-03-20 09:54:58 -06:00
dboreham 60c10d68cb Update to Gitea 1.9 2023-03-20 09:54:26 -06:00
3 changed files with 25 additions and 4 deletions
+16 -1
View File
@@ -6,7 +6,7 @@ networks:
services:
server:
image: gitea/gitea:1.18.3
image: gitea/gitea:1.19.0
environment:
- USER_UID=1000
- USER_GID=1000
@@ -18,6 +18,7 @@ services:
- GITEA__server__HTTP_PORT=3000
- GITEA__server__LOCAL_ROOT_URL=http://gitea.local:3000/
- GITEA__server__ROOT_URL=http://gitea.local:3000/
- GITEA__actions__ENABLED=true
- GITEA__security__INSTALL_LOCK=true
restart: always
networks:
@@ -47,3 +48,17 @@ services:
- gitea
volumes:
- ./postgres:/var/lib/postgresql/data
runner:
image: cerc/act-runner:local
restart: always
environment:
- GITEA_INSTANCE_INSECURE=1
- GITEA_RUNNER_REGISTRATION_TOKEN=eMdEwIzSo87nBh0UFWZlbp308j6TNWr3WhWxQqIc
- GITEA_INSTANCE_URL=http://host.docker.internal:3000
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://cerc/act_runner-task-executor:local,ubuntu-22.04:docker://cerc/act_runner-task-executor:local
networks:
- gitea
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./act_runner:/data
+8 -3
View File
@@ -7,6 +7,7 @@ GITEA_USER_EMAIL=${GITEA_USER}@example.com
GITEA_NEW_ORGANIZATION=cerc-io
GITEA_URL_PREFIX=http://localhost:3000
CERC_GITEA_TOKEN_NAME=laconic-so-publication-token
CERC_GITEA_RUNNER_REGISTRATION_TOKEN=eMdEwIzSo87nBh0UFWZlbp308j6TNWr3WhWxQqIc
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
set -x
fi
@@ -17,8 +18,7 @@ if [[ -z ${CERC_SO_COMPOSE_PROJECT} ]] ; then
else
compose_command="docker compose -p ${CERC_SO_COMPOSE_PROJECT}"
fi
# HACK: sleep a bit because gitea may not be up yet (container reports it has started before service is available)
sleep 5
sleep 15
${compose_command} exec --user git server gitea admin user list --admin | grep -v -e "^ID" | awk '{ print $2 }' | grep ${GITEA_USER} > /dev/null
if [[ $? == 1 ]] ; then
# Then create if it wasn't found
@@ -44,7 +44,7 @@ if [[ ${token_found} != 1 ]] ; then
new_gitea_token=$( curl -s -X POST "${GITEA_URL_PREFIX}/api/v1/users/${GITEA_USER}/tokens" \
-u ${GITEA_USER}:${GITEA_PASSWORD} \
-H "Content-Type: application/json" \
-d '{"name":"'${CERC_GITEA_TOKEN_NAME}'"}' \
-d '{"name":"'${CERC_GITEA_TOKEN_NAME}'", "scopes": [ "sudo" ] }' \
| jq -r .sha1 )
echo "This is your gitea access token: ${new_gitea_token}. Keep it safe and secure, it can not be fetched again from gitea."
echo "To use with laconic-so set this environment variable: export CERC_NPM_AUTH_TOKEN=${new_gitea_token}"
@@ -76,5 +76,10 @@ if [[ $? != 0 ]] ; then
-d '{"username": "'${GITEA_NEW_ORGANIZATION}'"}' > /dev/null
echo "Created the organization ${GITEA_NEW_ORGANIZATION}"
fi
# Seed a token for act_runner registration.
docker compose -p ${CERC_SO_COMPOSE_PROJECT} exec db psql -U gitea -d gitea -c "INSERT INTO public.action_runner_token(token, owner_id, repo_id, is_active, created, updated, deleted) VALUES('${CERC_GITEA_RUNNER_REGISTRATION_TOKEN}', 0, 0, 'f', 1679000000, 1679000000, NULL);" >/dev/null
echo "Gitea was configured to use host name: gitea.local, ensure that this resolves to localhost, e.g. with sudo vi /etc/hosts"
echo "Success, gitea is properly initialized"
+1
View File
@@ -4,3 +4,4 @@ if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
fi
mkdir -p ./gitea
mkdir -p ./gitea/ssh
mkdir -p ./act_runner