innolitics/rdm

Error during history.yml file generation

Closed this issue · 4 comments

I am trying out your software on a dummy project

The documentation and the code standard of your project is awesome, however I have a couple of problems with the history.yml file generation. I am running Windows 10 Enterprise (x64),, with make installed with Chocolatey
Python3.8

I do the following steps (in Anaconda console)

  1. rdm init
  2. cd regulatory
  3. git clone https://github.com/hmogensen/my-sample-project
  4. Change line 9 in config.yml to: my-sample-project
  5. make

Output:

(base) C:\Users\226077\Documents\sandbox\regulatory>make
rdm pull config.yml > data/history.yml
No access token is stored in the GH_API_TOKEN environment variable.
See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-linefor details.
Defaulting to username / password for login.
hmogensen
GitHub password (will not echo to console):
Traceback (most recent call last):
File "c:\users\226077\anaconda3\lib\site-packages\rdm\main.py", line 21, in main
exit_code = cli(sys.argv[1:])
File "c:\users\226077\anaconda3\lib\site-packages\rdm\main.py", line 43, in cli
pull_from_project_manager(args.config)
File "c:\users\226077\anaconda3\lib\site-packages\rdm\pull.py", line 15, in pull_from_project_manager
pm_backend = BackendClass(config)
File "c:\users\226077\anaconda3\lib\site-packages\rdm\project_management\github.py", line 21, in init
self.github_repository = self.github_browser.get_repo(self.config['repository'])
File "c:\users\226077\anaconda3\lib\site-packages\github\MainClass.py", line 345, in get_repo
headers, data = self.__requester.requestJsonAndCheck(
File "c:\users\226077\anaconda3\lib\site-packages\github\Requester.py", line 315, in requestJsonAndCheck
return self.__check(
File "c:\users\226077\anaconda3\lib\site-packages\github\Requester.py", line 340, in __check
raise self.__createException(status, responseHeaders, output)
github.GithubException.UnknownObjectException: 404 {"message": "Not Found", "documentation_url": "https://docs.github.com/rest"}

make: *** [Makefile:31: data/history.yml] Error 1
make: *** Deleting file 'data/history.yml'

If I rerun make, only one file from the documents folder will be processed unless I comment out the commands @mkdir -p $(@D) in the Makefile, since the script tries creating a new folder each time. After having performed this modification, running make yields the following output:

Traceback (most recent call last):
File "c:\users\226077\anaconda3\lib\site-packages\rdm\main.py", line 21, in main
exit_code = cli(sys.argv[1:])
File "c:\users\226077\anaconda3\lib\site-packages\rdm\main.py", line 36, in cli
render_template_to_file(config, args.template, context, sys.stdout)
File "c:\users\226077\anaconda3\lib\site-packages\rdm\render.py", line 38, in render_template_to_file
generator = generate_template_output(config, template_filename, context, loaders=loaders)
File "c:\users\226077\anaconda3\lib\site-packages\rdm\render.py", line 50, in generate_template_output
output_line_list = generate_template_output_lines(environment, template_filename, context)
File "c:\users\226077\anaconda3\lib\site-packages\rdm\render.py", line 62, in generate_template_output_lines
source_line_list = _generate_source_line_list(template, context)
File "c:\users\226077\anaconda3\lib\site-packages\rdm\render.py", line 91, in _generate_source_line_list
source = ''.join(generator)
File "c:\users\226077\anaconda3\lib\site-packages\jinja2\environment.py", line 1125, in generate
yield self.environment.handle_exception()
File "c:\users\226077\anaconda3\lib\site-packages\jinja2\environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "c:\users\226077\anaconda3\lib\site-packages\jinja2_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File ".\documents\release_history.md", line 31, in top-level template code
{% for cr in history.change_requests|rejectattr('is_problem_report') %}
File "c:\users\226077\anaconda3\lib\site-packages\jinja2\environment.py", line 471, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'history' is undefined

Thanks for trying out RDM!

We'll have to look into this further, but it seems like a problem with the data/history.yml file that contains the development history for your project.

To start, lets just comment out these lines:

https://github.com/innolitics/rdm/blob/master/rdm/init_files/Makefile#L29-L31

and also delete this file:

https://github.com/innolitics/rdm/blob/master/rdm/init_files/documents/release_history.md

Then see if everything works. If so, then we can look into what's going on with the history.yml file generation.

Thanks a lot for your quick reply. With your adjustments, the make command executes without error.
I will rename this issue to be only about the history.yml file generation, and maybe I will open a new one about adding features from my sample project.

I haven't dived too deep in the reason for the above error. However, funny thing is I could not reproduce the error after importing your project to Gitlab and redoing the setup (on the same computer). The error occurs when I clone a project to a subfolder in the regulatory folder, and update the config.yml file as described in the first post. The only second error I still had this time was something with the mkdir command, instead of interpreting the -p flag as a setting the command interprets it as the name of a folder. Thus it creates a folder named release and a folder named -p for the first document, and for the second document it throws an error because the folder it tries to create already exists. This is probably a Windows idiosyncrasy, if I was more familiar with bash scripting I would provide a quick solution to this problem for you but now I just comment out these lines and create the folder manually.

I haven't dived too deep in the reason for the above error. However, funny thing is I could not reproduce the error after importing your project to Gitlab and redoing the setup (on the same computer). The error occurs when I clone a project to a subfolder in the regulatory folder, and update the config.yml file as described in the first post. The only second error I still had this time was something with the mkdir command, instead of interpreting the -p flag as a setting the command interprets it as the name of a folder. Thus it creates a folder named release and a folder named -p for the first document, and for the second document it throws an error because the folder it tries to create already exists. This is probably a Windows idiosyncrasy, if I was more familiar with bash scripting I would provide a quick solution to this problem for you but now I just comment out these lines and create the folder manually.

Regarding the issue with the -p directory, it has to do with your environment you use for make. Out of the box, you cannot run the Makefile in windows. I tried a variety of different consoles and settled on git-bash, with a manual installation of make. This combination let me run the Makefile successfully, since it supported all the commands.