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

python_app_version doesn't get set in partial playbook runs #158

Open
rlskoeser opened this issue Oct 23, 2023 · 3 comments
Open

python_app_version doesn't get set in partial playbook runs #158

rlskoeser opened this issue Oct 23, 2023 · 3 comments
Milestone

Comments

@rlskoeser
Copy link
Contributor

rlskoeser commented Oct 23, 2023

For python apps, we get the python_app_version from the current checkout of the code and use it to determine the path for the deployed version. When we run playbooks without running the full sequence, e.g. using the --start-at-task option, this variable doesn't get set, and then any task that needs to know the path to the deployed version of the project fails.

The task is currently part of the build_project_repo role: https://github.com/Princeton-CDH/cdh-ansible/blob/main/roles/build_project_repo/tasks/main.yml#L43-L54

On a new deploy, it can't be run until the new version of the code has been checked out; but on an existing deploy it could be run anytime.

@rlskoeser rlskoeser changed the title python_app_version doesn't get set when running roles out of order python_app_version doesn't get set in partial playbook runs Oct 23, 2023
@acozine
Copy link
Collaborator

acozine commented Oct 23, 2023

Interesting challenge. You could try moving the Get python package version task into a pre-tasks section in the playbook - I'm not sure how pre-tasks interact with --start-at-task. If you know the value you need, you could pass it as an extra variable, for example, -e python_app_version=x.x when you run with --start-at-task. I'm not sure what outcome you're most interested in here - running with --start-at-task? handling new deploys? something else?

@rlskoeser
Copy link
Contributor Author

@acozine thanks so much for looking and commenting. One use case is running --start-at-task and not having to worry about this being unset. I now have a new use case which is why I'm prioritizing fixing this: for the db upgrade I'm doing with Francis, we figured out that we could write a minimal playbook to do the necessary db setup for cdh applications and then update the settings so the application is configured to use the new db. In order to update the settings, I need to know the path for the current deploy - which relies on this python app version (and also on a a git hash from git info, which I figured out when I tried running it). I've got a preliminary solution that pulls these two steps out into a separate task that can be included in the role and included in the new db setup/migration playbook - but that doesn't resolve the --start-at-task use case.

@rlskoeser
Copy link
Contributor Author

use the current symlink as the default value; update with variables when needed (i.e. full deploy); possibly a next symlink would help with this too

@rlskoeser rlskoeser added this to the Fall cleaning milestone Sep 20, 2024
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

No branches or pull requests

2 participants