#3780 Fix onboarding issues
Merged by pingou. Opened by alexgleason.
alexgleason/pagure onboarding  into  master

Download 3780.patch
  • Docker Compose is moved above Vagrant in the README. It's easier to get started with (everything works without tinkering) so it makes sense to prioritize it as the recommended option. All 3 options are pointed out at the top now, making it easier to know your options.
  • Instructions for using dev-data.py with Compose is added to the README.
  • Ubuntu instructions are added for Vagrant. While Pagure is a Fedora project, Ubuntu users may want to contribute.
  • dev-data.py has been painstakingly debugged and brought up-to-date with the current project codebase. There was only one thing I could not fix: the script relies on add_content_git_repo function in tests, which gives a Unicode error on 'fileŠ'. I've commented out that part of the test for now.
  • Users created with dev-data.py are assigned passwords (testing123) and activated instantly. This solves the need to generate a password hash, query the database, and activate each user manually. Simply running dev-data.sh now helps the user get set up.
  • A bug in dev-data.py is fixed. The script would continue running even if the user didn't type "yes". Now the script quits if anything except "yes" is entered.
  • Some id's for objects created with dev-data.py needed to be hardcoded. Running the script multiple times would autoincrement the id's and break the rest of the script.
  • Vagrant's .bashrc now puts the user inside of ~/devel automatically. Without this it's confusing why your repo doesn't match your current directory.
  • Vagrant's .bashrc now runs workon python2-pagure automatically. Without this it's confusing why dev-data.py says you're missing libraries like mock.
  • Vagrant now has PAGURE_AUTH = 'local' by default. Without it, the login page takes you to FAS which is confusing, and it's difficult to know how to disable it.

My hope is that this will make things easier for Outreachy contributors.

Did we fix all the methods to use Fedora 28 and Python 3 yet? The current methods are kind of rotted from how they should be working...

I think we should default to python3 here

This needs to be fix, it's a valid test that we really want to keep.

@alexgleason With this your fix I'm finally able to use the local instance on docker compose, thanks :) I only needed to install mock.

It could be done in a separate PR. There is no option for Python 3. I am simply fixing the existing environment, not adding to it yet.

Maybe this relies on using Python 3. It wouldn't work in Python 2. What do you suggest?

Switching the dev environment to Python 3 is also a big change. Is there any way you can help me fix the test to work in Python 2 for now and then handle Python 3 in a separate PR?

Issues with tests aside, I need to push another commit to fix mock not being installed in the container by default and apparently there's still a small bug when running dev-data.py

1 new commit added

  • Install tests_requirements.txt into Docker container, fix minor readme typo

Okay, I got mock installed in the container now.

I learned the hard way that when testing docker-compose, you must delete everything and start over to ensure it's a clean environment.

# Delete EVERYTHING
docker-compose -f dev/docker-compose.yml rm
docker volume prune
sudo git clean -fdx
# Now start over
mkdir -p lcl/{repos,remotes,attachments,releases}
docker-compose -f dev/docker-compose.yml build
docker-compose -f dev/docker-compose.yml up

I'm still running into another problem. I hardcoded the ID's of database objects, because later in the script it accesses them by ID. Running the script more than once makes the second part of the script break because of autoindex. Sadly, now we have the reverse problem. Creating a new data object with autoindex will complain that an object with id=1 already exists because apparently inserting a row where the pkey is explicit prevents autoindex from incrementing. So parts of the script need to be fixed to stop relying on IDs.

1 new commit added

  • Fix autoincrement issues, fix tests

rebased onto bd435d424f13c5ca2754fec3535f81282b77e438

rebased onto 259bc46f945d9619b3bd88a5a2f215a30348773c

Okay, I am leaving the tests alone now. Instead, I copied the function I needed directly into dev-data.py for now. Perhaps it's heavy-handed, but at least it works, which is an improvement.

I think this can be merged now and Python 3 can be handled in a separate PR since Python 3 support never existed for docker-compose (or Vagrant) in the first place.

It says "this pull request must be rebased before merging" but...

I tried

git fetch origin
git merge origin/master
git push alex onboarding

and it shows 52 file changes and diffs for the entire merge commit in the Pagure UI. Is that a bug in Pagure and I should go ahead and push that version back? (I force pushed to how it was before).

That's because you use merge, what you want is rebase.
An handy way to get it is git pull --rebase origin master on your working branch. You will then need to force-push since you re-wrote history but this way pagure's history remains linear :)

rebased onto 6656f76a7ac4c45d600c5e3a14365cb170672062

I see. I almost used cherry-pick but this is way better, thanks! Updated my branch.

1 new commit added

  • Let templates autoreload in Docker container

1 new commit added

  • Let templates autoreload in Docker container

I also added TEMPLATES_AUTO_RELOAD = True to the Compose environment. Without it, Jinja will cache templates and won't reload them without restarting the whole dev server.

I also added TEMPLATES_AUTO_RELOAD = True to the Compose environment. Without it, Jinja will cache templates and won't reload them without restarting the whole dev server.

Good idea, it's also useful to debug theming sometime

Pull-Request has been merged by pingou

Metadata