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

Update Pre-commit hooks and enforce git fetch to be successful #274

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-toml
Expand All @@ -10,16 +10,16 @@ repos:
- id: trailing-whitespace
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v4.0.0-alpha.8
hooks:
- id: prettier
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.27.1
rev: v1.35.1
hooks:
- id: yamllint
args: ["-c=.yamllint", "."]
- repo: https://github.com/ansible-community/ansible-lint.git
rev: v6.10.2
rev: v24.6.1
hooks:
- id: ansible-lint
files: \.(yaml|yml)$
6 changes: 6 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@ rules:
level: warning
braces:
level: warning
max-spaces-inside: 1
document-start:
level: error
comments-indentation: false
comments:
level: error
min-spaces-from-content: 1
octal-values:
forbid-implicit-octal: true
forbid-explicit-octal: true
truthy:
level: error

Expand Down
2 changes: 1 addition & 1 deletion tasks/custom_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ansible.builtin.file:
path: /etc/ansible/facts.d
state: directory
mode: 0755
mode: "0755"

- name: Copy over check-configure-options.py
ansible.builtin.template:
Expand Down
21 changes: 14 additions & 7 deletions tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
dest: "{{ pyenv_path }}"
version: "{{ pyenv_version }}"
update: "{{ pyenv_update_git_install }}"
force: true

- name: Install PyEnv-virtualenv plugin
ansible.builtin.git:
repo: https://github.com/yyuu/pyenv-virtualenv.git
dest: "{{ pyenv_path }}/plugins/pyenv-virtualenv"
version: "{{ pyenv_virtualenv_version }}"
update: "{{ pyenv_update_git_install }}"
force: true
when: pyenv_enable_virtualenvs

- name: Install PyEnv-update plugin
Expand All @@ -20,6 +22,7 @@
dest: "{{ pyenv_path }}/plugins/pyenv-update"
version: "{{ pyenv_update_version }}"
update: "{{ pyenv_update_git_install }}"
force: true
when: pyenv_update

- name: Install .pyenvrc
Expand Down Expand Up @@ -53,41 +56,45 @@
regexp: "\\.pyenvrc$"
line: "source {{ pyenvrc_path }}/.pyenvrc"
state: present
mode: 0644
mode: "0644"
create: true

- name: "Add pyenv autocomplete in {{ pyenv_shellrc_file }}"
ansible.builtin.lineinfile:
dest: "{{ pyenv_shellrc_file }}"
regexp: "pyenv\\.bash$"
line: "source {{ pyenv_path }}/completions/pyenv.bash"
mode: 0644
mode: "0644"
state: present
when: pyenv_enable_autocompletion

- name: Update Pyenv interpreter list
ansible.builtin.shell: . {{ pyenvrc_path }}/.pyenvrc && pyenv update
ansible.builtin.shell:
cmd: . {{ pyenvrc_path }}/.pyenvrc && pyenv update
register: output
changed_when: "output.rc == 0"
when: pyenv_update

- name: Uninstall existing Python interpreters w/ wrong compilation flags
ansible.builtin.shell: ". {{ pyenvrc_path }}/.pyenvrc && pyenv uninstall -f {{ item }}"
ansible.builtin.shell:
cmd: ". {{ pyenvrc_path }}/.pyenvrc && pyenv uninstall -f {{ item }}"
args:
removes: "{{ pyenv_path }}/versions/{{ item }}/bin/python"
loop: "{{ ansible_local['pyenv_python_installations']['to_reinstall'] | default([]) }}"
when: pyenv_uninstall_python_w_wrong_configure_opts

- name: "Install Python interpreters {{ pyenv_python_versions }}"
ansible.builtin.shell: ". {{ pyenvrc_path }}/.pyenvrc && pyenv install {{ pyenv_install_extra_opts }} {{ item }}"
ansible.builtin.shell:
cmd: ". {{ pyenvrc_path }}/.pyenvrc && pyenv install {{ pyenv_install_extra_opts }} {{ item }}"
args:
creates: "{{ pyenv_path }}/versions/{{ item }}/bin/python"
with_items: "{{ pyenv_python_versions }}"

- name: Create virtual environments
ansible.builtin.shell:
. {{ pyenvrc_path }}/.pyenvrc && pyenv virtualenv {{ item.py_version }} {{ item.venv_name }}
creates="{{ pyenv_path }}/versions/{{ item.py_version }}/envs/{{ item.venv_name }}/bin/python"
cmd: . {{ pyenvrc_path }}/.pyenvrc && pyenv virtualenv {{ item.py_version }} {{ item.venv_name }}
args:
creates: "{{ pyenv_path }}/versions/{{ item.py_version }}/envs/{{ item.venv_name }}/bin/python"
with_items: "{{ pyenv_virtualenvs }}"
when: pyenv_enable_virtualenvs

Expand Down