diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 49f0d69..89e9f88 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -31,17 +31,45 @@ jobs: - name: Test plugins _TEST.py run: | python3 plugins/*_TEST.py - - name: Smoke system tests for repository module + + system_tests_setup: + runs-on: ubuntu-latest + needs: [build] + steps: + - name: System smoke test setup run: | python3 gzdev.py repository list repo_to_test="osrf" repo_type_to_test="stable" sudo env "PYTHONPATH=$pythonLocation/lib/python${{ matrix.python-version}}/site-packages" \ python3 ./gzdev.py repository enable ${repo_to_test} ${repo_type_to_test} + + repo_system_test_precleanup: + runs-on: ubuntu-latest + needs: [system_tests_setup] + steps: + - name: Smoke system tests for repository module + run: sudo env "PYTHONPATH=$pythonLocation/lib/python${{ matrix.python-version}}/site-packages" \ python3 ./gzdev.py repository --pre-cleanup enable ${repo_to_test} ${repo_type_to_test} >log grep "/etc/apt/sources.list.d/_gzdev_${repo_to_test}_${repo_type_to_test}.list" log grep "/usr/share/keyrings/_gzdev_${repo_to_test}_${repo_type_to_test}.gpg" log + + repo_system_test_purge: + runs-on: ubuntu-latest + needs: [system_tests_setup] + steps: + - name: Smoke system tests for repository module + run: + sudo env "PYTHONPATH=$pythonLocation/lib/python${{ matrix.python-version}}/site-packages" \ + python3 ./gzdev.py repository purge >log + grep "/etc/apt/sources.list.d/_gzdev_${repo_to_test}_${repo_type_to_test}.list" log + grep "/usr/share/keyrings/_gzdev_${repo_to_test}_${repo_type_to_test}.gpg" log + + docker_tests: + runs-on: ubuntu-latest + needs: [build] + steps: - name: Smoke system tests for ign-docker module run: | python3 gzdev.py ign-docker-env citadel diff --git a/plugins/repository.py b/plugins/repository.py index 82911c1..4d802cb 100644 --- a/plugins/repository.py +++ b/plugins/repository.py @@ -15,6 +15,7 @@ enable Enable repository in the system disable Disable repository (if present) list List repositories enabled + purge Remove all configurations installed by gzdev Options: -h --help Show this screen @@ -22,8 +23,7 @@ --gpg-check Do run a gpg check for validating the key downloaded in enable action (need the gpg binary) - --pre-cleanup Remove all repositories and keys installed - by gzdev from the system before proceding + --pre-cleanup Run 'purge' action before proceeding """ import distro @@ -225,6 +225,9 @@ def normalize_args(args): force_linux_distro = args['--force-linux-distro'] gpg_check = args['--gpg_check'] if '--gpg_check' in args else False pre_cleanup = args['--pre-cleanup'] if '--pre-cleanup' in args else False + if pre_cleanup and action != 'enable': + error('--pre-cleanup is only supported in the "enable" action' + f'(not in {action})') if force_linux_distro: linux_distro = force_linux_distro else: @@ -277,6 +280,8 @@ def process_input(args, config): gpg_check) elif (action == 'disable'): disable_repo(repo_name) + elif (action == 'purge'): + remove_all_installed() def remove_file_by_pattern(directory, pattern):