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

Fix AMI builds by pinning pip to 18.1 #3081

Merged
merged 1 commit into from
Jan 29, 2019
Merged

Fix AMI builds by pinning pip to 18.1 #3081

merged 1 commit into from
Jan 29, 2019

Conversation

rajadain
Copy link
Member

@rajadain rajadain commented Jan 29, 2019

Overview

As of pip 19.0, it started printing warnings for Python 2.7, which are treated as errors by Jenkins. I looked briefly in to ignoring or silencing those warnings (see pypa/pip#6147 (comment)), but couldn't configure Jenkins correctly. Thus, I'm going with the downgrade, as was done for #bees in project-icp/bee-pollinator-app#447.

Demo

http://civicci01.internal.azavea.com/view/mmw/job/model-my-watershed-packer-app-and-worker/1131

As of pip 19.0, it started printing warnings for Python 2.7, which
are treated as errors by Jenkins. I looked briefly in to ignoring
or silencing those warnings (see pypa/pip#6147 (comment)),
but couldn't configure Jenkins correctly. Thus, I'm going with the
downgrade, as was done for #bees in project-icp/bee-pollinator-app#447.
Copy link
Contributor

@hectcastro hectcastro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. To get the environment variable set in the correct context, I'd expect it to need to be set at the Ansible task level via https://stackoverflow.com/a/27736434:

Is that what you tried?

Either way, given that this works and is consistent with the other fix, I'd be OK with keeping it as is.

@rajadain
Copy link
Member Author

Ah! I'll try that. I just set it in as a Build Environment variable for Jenkins, but it didn't get picked up because the build runs Ansible, not pip.

@rajadain
Copy link
Member Author

rajadain commented Jan 29, 2019

Just tried this:

commit f730cdae655cd7e77456335a29d028a9c805393b
Author: Terence Tuhinanshu <[email protected]>
Date:   Tue Jan 29 14:01:08 2019 -0500

    Add environment variable to suppress warnings
    
    As of pip 19, it prints warnings about Python 2.7 (see https://github.com/pypa/pip/pull/6147)
    which register as errors in Jenkins, causing builds to fail. We
    suppress the warnings by declaring this environment variable.

diff --git a/deployment/ansible/roles/model-my-watershed.app/tasks/dependencies.yml b/deployment/ansible/roles/model-my-watershed.app/tasks/dependencies.yml
index a2353a09..b8b17454 100644
--- a/deployment/ansible/roles/model-my-watershed.app/tasks/dependencies.yml
+++ b/deployment/ansible/roles/model-my-watershed.app/tasks/dependencies.yml
@@ -1,6 +1,8 @@
 ---
 - name: Install numba
   pip: name=numba version={{ numba_version }}
+  environment:
+    PYTHONWARNINGS: ignore:Please.upgrade::pip._internal.cli.base_command
 
 - name: Install application Python dependencies for development and test
   pip: requirements="{{ app_home }}/requirements/{{ item }}.txt"
@@ -8,11 +10,15 @@
     - development
     - test
   when: "['development', 'test'] | some_are_in(group_names)"
+  environment:
+    PYTHONWARNINGS: ignore:Please.upgrade::pip._internal.cli.base_command
   notify:
     - Restart mmw-app
 
 - name: Install application Python dependencies for production
   pip: requirements="{{ app_home }}/requirements/production.txt"
   when: "['packer'] | is_in(group_names)"
+  environment:
+    PYTHONWARNINGS: ignore:Please.upgrade::pip._internal.cli.base_command
   notify:
     - Restart mmw-app
diff --git a/deployment/ansible/roles/model-my-watershed.celery-worker/tasks/dependencies.yml b/deployment/ansible/roles/model-my-watershed.celery-worker/tasks/dependencies.yml
index 443d9f03..5ed5c6cc 100644
--- a/deployment/ansible/roles/model-my-watershed.celery-worker/tasks/dependencies.yml
+++ b/deployment/ansible/roles/model-my-watershed.celery-worker/tasks/dependencies.yml
@@ -1,6 +1,8 @@
 ---
 - name: Install numba
   pip: name=numba version={{ numba_version }}
+  environment:
+    PYTHONWARNINGS: ignore:Please.upgrade::pip._internal.cli.base_command
 
 - name: Install application Python dependencies for development and test
   pip: requirements="{{ app_home }}/requirements/{{ item }}.txt"
@@ -8,11 +10,15 @@
     - development
     - test
   when: "['development', 'test'] | some_are_in(group_names)"
+  environment:
+    PYTHONWARNINGS: ignore:Please.upgrade::pip._internal.cli.base_command
   notify:
     - Restart Celery
 
 - name: Install application Python dependencies for production
   pip: requirements="{{ app_home }}/requirements/production.txt"
   when: "['packer'] | is_in(group_names)"
+  environment:
+    PYTHONWARNINGS: ignore:Please.upgrade::pip._internal.cli.base_command
   notify:
     - Restart Celery

but it didn't work: http://civicci01.internal.azavea.com/view/mmw/job/model-my-watershed-packer-app-and-worker/1132

I'm going to remove that commit and merge the rest for now.

@rajadain rajadain merged commit 05ad197 into develop Jan 29, 2019
@rajadain rajadain deleted the tt/fix-ami-builds branch January 29, 2019 19:15
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.

2 participants