Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add tests for gitea #421

Merged
merged 62 commits into from
Aug 5, 2023
Merged

chore: add tests for gitea #421

merged 62 commits into from
Aug 5, 2023

Conversation

MarcoIeni
Copy link
Owner

@MarcoIeni MarcoIeni commented Jan 8, 2023

Close #388
WIP

  • create a user token with this endpoint

useful links

@MarcoIeni
Copy link
Owner Author

Currently, I'm trying to create a Gitea user from the admin user. However, the basic auth with the "root" user is not working. I don't know what the default root username and password are.

@era
Copy link
Contributor

era commented Jan 17, 2023

I will take a look at the process for this since it seems like we may need to set up the admin user manually as per: https://discourse.gitea.io/t/unattended-gitea-installation-from-the-cli/3373/12 and go-gitea/gitea#4120

@MarcoIeni
Copy link
Owner Author

This was in the PR:

the first user registered to Gitea becomes the admin.

Now it's clearer, thanks.

However there's not a way to run an exec from docker compose.
I guess there's no way to create the first user via api, right?

@era
Copy link
Contributor

era commented Jan 18, 2023

It does not look like we can use the API in order to create it (I may be wrong, I just couldn't find how to). But if we remove the GITEA__security__INSTALL_LOCK=true flag, we could use the installation page in order to create it (it does feel a hacky solution tho): https://discourse.gitea.io/t/unattended-gitea-installation-from-the-cli/3373

Another option is to use the sign_up form: https://discourse.gitea.io/t/gitea-rest-api-to-create-a-new-admin-user/2310/8

@MarcoIeni
Copy link
Owner Author

we could use the installation page in order to create it

My goal is to run the tests in CI, so no manual steps should be required :/

@era
Copy link
Contributor

era commented Jan 18, 2023

My goal is to run the tests in CI, so no manual steps should be required :/

@MarcoIeni that would not be a manual step, we would invoke the installation page using our Rust code (for example, the link I gave on the last comment uses curl). The only difference is that since it's not meant for machines to access, if in some newer version, they change any of the form input names, we may have to update it (in other words, it's less stable than a proper API).

@MarcoIeni
Copy link
Owner Author

oh ok. Yes, this can work, too :)

@era era mentioned this pull request Jan 19, 2023
@MarcoIeni
Copy link
Owner Author

MarcoIeni commented Mar 25, 2023

Getting back to this today. Options:

  1. run gitea admin user create --username marco --password psw --email a@b.com when running tests at the beginning. with docker exec.

@MarcoIeni MarcoIeni marked this pull request as ready for review August 5, 2023 17:34
@MarcoIeni MarcoIeni enabled auto-merge (squash) August 5, 2023 17:34
@MarcoIeni MarcoIeni merged commit 77da21b into main Aug 5, 2023
10 checks passed
@MarcoIeni MarcoIeni deleted the gitea-test branch August 5, 2023 17:39
@release-plz release-plz bot mentioned this pull request Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test release pr with gitea docker image
2 participants