Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Alias for installing bindings #210

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions roles/pulp-devel/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- tmux
- tree
- wget
- gnupg
state: present
retries: "{{ pulp_devel_package_retries }}"
register: result
Expand All @@ -23,8 +24,23 @@
package:
name:
- python-virtualenvwrapper
- podman
when: ansible_distribution == 'CentOS'

- name: Ensure podman apt key is present (Debian-specific)
apt_key:
url: "https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable\
/{{ ansible_distribution }}_{{ ansible_distribution_version }}/Release.key"
state: present
when: ansible_distribution == 'Debian'

- name: Ensure podman repository (Debian-specific)
apt_repository:
repo: "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable\
/{{ ansible_distribution }}_{{ ansible_distribution_version }}/ /"
filename: libcontainers
when: ansible_distribution == 'Debian'

- name: Install several useful packages (Debian-specific)
package:
name:
Expand All @@ -35,12 +51,21 @@
- virtualenvwrapper
- ripgrep
- vim
- software-properties-common
- podman
state: present
retries: "{{ pulp_devel_package_retries }}"
register: result
until: result is succeeded
when: ansible_distribution == 'Debian'

- name: Adding podman registries (Debian-specific)
command: echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | tee /etc/containers/registries.conf
become: yes
args:
creates: /etc/containers
when: ansible_distribution == 'Debian'

- name: Install several useful packages (Fedora-specific)
package:
name:
Expand All @@ -53,6 +78,7 @@
- python3-virtualenvwrapper
- ripgrep
- vim-enhanced
- podman
state: present
retries: "{{ pulp_devel_package_retries }}"
register: result
Expand Down Expand Up @@ -143,6 +169,15 @@
dest: '{{ developer_user_home }}/.bashrc.d/venv.bashrc'
when: ansible_distribution != 'Ubuntu'

- name: Install bindings requirements for testing locally
shell: >-
source {{ developer_user_home }}/.bashrc.d/alias.bashrc
&& source {{ developer_user_home }}/.bashrc.d/venv.bashrc
&& pbindings {{ item.key| replace("-", "_") }} python
args:
executable: /bin/bash
with_dict: "{{ pulp_install_plugins }}"

- name: Add fzf bashrc
copy:
src: files/fzf.bashrc
Expand Down
31 changes: 31 additions & 0 deletions roles/pulp-devel/templates/alias.bashrc.j2
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,34 @@ pyclean () {
find . -type d -name "__pycache__" -delete
}
_pyclean_help="Cleanup extra python files"

pbindings(){
Copy link
Member

Choose a reason for hiding this comment

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

Does making some way to install, uninstall, or reinstall make any sense. As code changes in PRs it would be convenient to have 1 command to reinstall that plugins' bindings. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

the command is idempotent, so for reinstall, you just need to call it again

Copy link
Member

Choose a reason for hiding this comment

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

oh nice that makes it simple which is great. No changes needed here.

CURRENT_DIR=$(pwd)

if [ -d $HOME/devel/pulp-openapi-generator ]
then
cd $HOME/devel/pulp-openapi-generator
else
cd $HOME/devel
git clone https://github.com/pulp/pulp-openapi-generator.git
cd pulp-openapi-generator
fi

sed -i 's/docker/podman/g' generate.sh
workon pulp

if [ $1 != 'pulpcore' ]
then
sudo ./generate.sh pulpcore $2
pip install ./pulpcore-client
sudo rm -rf pulpcore-client
fi

sudo ./generate.sh $@
pip install ./$1-client
Copy link
Member

Choose a reason for hiding this comment

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

This actually does use the local source, so this part is good.

sudo rm -rf $1-client

sed -i 's/podman/docker/g' generate.sh
cd $CURRENT_DIR
}
_pbindings_help="Install bindings"