You've already forked woodpecker
							
							
				mirror of
				https://github.com/woodpecker-ci/woodpecker.git
				synced 2025-10-30 23:27:39 +02:00 
			
		
		
		
	Fix Gitpod: Gitea auth token creation (#3299)
The Gitea CLI `generate-access-token` has updated the OAuth scopes and [posts some warning to the STDOUT when creating a token](https://github.com/go-gitea/gitea/issues/28758): ``` .../setting/security.go:168:loadSecurityFrom() [W] Enabling Query API Auth tokens is not recommended. DISABLE_QUERY_AUTH_TOKEN will default to true in gitea 1.23 and will be removed in gitea 1.24. 0adftokenblablubb ``` When logging in to the Gitpod Gitea instance from Woodpecker, I get an error:  This PR fixes the problems leading you to a dialogue authorizing Woodpecker after logging in to Gitea. --------- Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
This commit is contained in:
		| @@ -42,10 +42,11 @@ tasks: | ||||
|       $DOCKER_COMPOSE_CMD up -d | ||||
|       until curl --output /dev/null --silent --head --fail http://localhost:3000; do printf '.'; sleep 1; done | ||||
|       $GITEA_CLI_CMD admin user create --username woodpecker --password password --email woodpecker@localhost --admin | ||||
|       export GITEA_TOKEN=$($GITEA_CLI_CMD admin user generate-access-token -u woodpecker --scopes repo,write:application --raw) | ||||
|       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 }') | ||||
|       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}" \ | ||||
|         -d "{ \"name\": \"Woodpecker CI\", \"confidential_client\": true, \"redirect_uris\": [ \"https://8000-${GITPOD_WORKSPACE_ID}.${GITPOD_WORKSPACE_CLUSTER_HOST}/authorize\" ] }") | ||||
|       touch .env | ||||
|       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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user