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

Commit

Permalink
Merge pull request #210 from fabricio-aguiar/6032
Browse files Browse the repository at this point in the history
Alias for installing bindings
  • Loading branch information
bmbouter committed Jan 27, 2020
2 parents aa3bd37 + 0f12eb8 commit d7ef46b
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
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(){
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
sudo rm -rf $1-client

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

0 comments on commit d7ef46b

Please sign in to comment.