From cd0ab573b0e5a8967d6d32ea93e18631cbfef909 Mon Sep 17 00:00:00 2001 From: Fabricio Aguiar Date: Thu, 11 Mar 2021 13:21:11 -0300 Subject: [PATCH 1/2] Update require_pulp_plugins [noissue] --- functest_requirements.txt | 4 ++-- pulp_python/tests/functional/utils.py | 2 +- template_config.yml | 2 +- test_requirements.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/functest_requirements.txt b/functest_requirements.txt index 0c040310..11db5441 100644 --- a/functest_requirements.txt +++ b/functest_requirements.txt @@ -1,2 +1,2 @@ -git+https://github.com/PulpQE/pulp-smash.git#egg=pulp-smash -pytest \ No newline at end of file +git+https://github.com/pulp/pulp-smash.git#egg=pulp-smash +pytest diff --git a/pulp_python/tests/functional/utils.py b/pulp_python/tests/functional/utils.py index 81abbe06..c645d270 100644 --- a/pulp_python/tests/functional/utils.py +++ b/pulp_python/tests/functional/utils.py @@ -45,7 +45,7 @@ def set_up_module(): """Skip tests Pulp 3 isn't under test or if pulp_python isn't installed.""" require_pulp_3(SkipTest) - require_pulp_plugins({"pulp_python"}, SkipTest) + require_pulp_plugins({"python"}, SkipTest) def gen_python_client(): diff --git a/template_config.yml b/template_config.yml index 4b0e97c9..b47ad8a6 100644 --- a/template_config.yml +++ b/template_config.yml @@ -13,7 +13,7 @@ deploy_client_to_rubygems: true deploy_daily_client_to_pypi: true deploy_daily_client_to_rubygems: true deploy_to_pypi: true -docker_fixtures: true +docker_fixtures: false docs_test: true plugin_app_label: python plugin_camel: PulpPython diff --git a/test_requirements.txt b/test_requirements.txt index 031bfa99..d5c09b9c 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -5,6 +5,6 @@ flake8-docstrings flake8-tuple flake8-quotes mock -git+https://github.com/PulpQE/pulp-smash.git#egg=pulp-smash +git+https://github.com/pulp/pulp-smash.git#egg=pulp-smash pydocstyle<4 pytest From d2efc04cd1c2fd7350c6f1ae6726eb9e72481791 Mon Sep 17 00:00:00 2001 From: Fabricio Aguiar Date: Thu, 11 Mar 2021 13:22:03 -0300 Subject: [PATCH 2/2] Update CI from plugin-template [noissue] --- .ci/ansible/smash-config.json | 5 +-- .ci/ansible/start_container.yaml | 2 +- .ci/scripts/check_gettext.sh | 22 ++++++++++ .ci/scripts/publish_client_gem.sh | 2 +- .ci/scripts/publish_client_pypi.sh | 2 +- .github/workflows/ci.yml | 4 ++ .github/workflows/fips.yml | 62 ++++++++++++++++++++++++++++ .github/workflows/nightly.yml | 1 + .github/workflows/release.yml | 1 + .github/workflows/scripts/install.sh | 13 +++--- .github/workflows/scripts/utils.sh | 6 +-- template_config.yml | 3 ++ 12 files changed, 106 insertions(+), 17 deletions(-) create mode 100755 .ci/scripts/check_gettext.sh create mode 100644 .github/workflows/fips.yml diff --git a/.ci/ansible/smash-config.json b/.ci/ansible/smash-config.json index 432c5130..9af43820 100644 --- a/.ci/ansible/smash-config.json +++ b/.ci/ansible/smash-config.json @@ -29,8 +29,5 @@ } } } - ], - "custom": { - "fixtures_origin": "http://pulp-fixtures:8080/" - } + ] } diff --git a/.ci/ansible/start_container.yaml b/.ci/ansible/start_container.yaml index bdf35b43..d75a7083 100644 --- a/.ci/ansible/start_container.yaml +++ b/.ci/ansible/start_container.yaml @@ -74,7 +74,7 @@ follow_redirects: none register: result until: result.status == 200 - retries: 6 + retries: 12 delay: 5 rescue: - name: "Output pulp container log" diff --git a/.ci/scripts/check_gettext.sh b/.ci/scripts/check_gettext.sh new file mode 100755 index 00000000..2170402f --- /dev/null +++ b/.ci/scripts/check_gettext.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# WARNING: DO NOT EDIT! +# +# This file was generated by plugin_template, and is managed by it. Please use +# './plugin-template --github pulp_python' to update this file. +# +# For more info visit https://github.com/pulp/plugin_template + +# make sure this script runs at the repo root +cd "$(dirname "$(realpath -e "$0")")"/../.. + +set -uv + +# check for imports not from pulpcore.plugin. exclude tests +MATCHES=$(grep -n -r --include \*.py "_(f") + +if [ $? -ne 1 ]; then + printf "\nERROR: Detected mix of f-strings and gettext:\n" + echo "$MATCHES" + exit 1 +fi diff --git a/.ci/scripts/publish_client_gem.sh b/.ci/scripts/publish_client_gem.sh index 92dda0cb..a6db3c54 100755 --- a/.ci/scripts/publish_client_gem.sh +++ b/.ci/scripts/publish_client_gem.sh @@ -18,7 +18,7 @@ echo "--- :rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials sudo chmod 600 ~/.gem/credentials -export REPORTED_VERSION=$(http pulp/pulp/api/v3/status/ | jq --arg plugin pulp_python -r '.versions[] | select(.component == $plugin) | .version') +export REPORTED_VERSION=$(http pulp/pulp/api/v3/status/ | jq --arg plugin python -r '.versions[] | select(.component == $plugin) | .version') export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)" if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then export VERSION=${REPORTED_VERSION} diff --git a/.ci/scripts/publish_client_pypi.sh b/.ci/scripts/publish_client_pypi.sh index ccad28f3..80d4f713 100755 --- a/.ci/scripts/publish_client_pypi.sh +++ b/.ci/scripts/publish_client_pypi.sh @@ -14,7 +14,7 @@ cd "$(dirname "$(realpath -e "$0")")"/../.. pip install twine -export REPORTED_VERSION=$(http pulp/pulp/api/v3/status/ | jq --arg plugin pulp_python -r '.versions[] | select(.component == $plugin) | .version') +export REPORTED_VERSION=$(http pulp/pulp/api/v3/status/ | jq --arg plugin python -r '.versions[] | select(.component == $plugin) | .version') export DESCRIPTION="$(git describe --all --exact-match `git rev-parse HEAD`)" if [[ $DESCRIPTION == 'tags/'$REPORTED_VERSION ]]; then export VERSION=${REPORTED_VERSION} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ffa6e73..bc3560d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,6 +53,9 @@ jobs: - name: Check for pulpcore imports outside of pulpcore.plugin run: sh .ci/scripts/check_pulpcore_imports.sh + - name: Check for gettext problems + run: sh .ci/scripts/check_gettext.sh + test: runs-on: ubuntu-latest # run only after lint finishes @@ -120,3 +123,4 @@ jobs: docker logs pulp || true docker exec pulp ls -latr /etc/yum.repos.d/ || true docker exec pulp cat /etc/yum.repos.d/* || true + docker exec pulp pip3 list diff --git a/.github/workflows/fips.yml b/.github/workflows/fips.yml new file mode 100644 index 00000000..959b80f4 --- /dev/null +++ b/.github/workflows/fips.yml @@ -0,0 +1,62 @@ +# WARNING: DO NOT EDIT! +# +# This file was generated by plugin_template, and is managed by it. Please use +# './plugin-template --github pulp_python' to update this file. +# +# For more info visit https://github.com/pulp/plugin_template +--- +name: Pulp FIPS CI +on: + + workflow_dispatch: + +jobs: + vagrant: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + include: + - test_type: pulp3-source-centos8-fips + - test_type: pulp3-source-centos7-fips + steps: + - uses: actions/checkout@v2.3.1 + with: + submodules: true + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.7 + - name: Ansible + run: | + pip3 install -U pip + pip3 install "ansible>2.9,<3" + ansible --version + - name: Pulp Installer + run: | + cd .. + git clone --depth=1 https://github.com/pulp/pulp_installer + - name: Install Vagrant + shell: bash + run: | + cd ../pulp_installer/ + git submodule update --init + .github/workflows/scripts/install.sh ${{ matrix.test_type }} + cd .. + git clone https://github.com/pulp/pulpcore + - name: Run Vagrant + shell: bash + run: | + cd ../pulp_installer + sed -e "s/pulp-file/pulp-python/g" -e "s/pulp_file/pulp_python/g" -e "/pulp_source_dir/a pulp_webserver_disable_https: true" example.dev-config.yml > local.dev-config.yml + echo "vagrant ssh \$1 -c \"workon pulp && cd devel/pulp_python && pip install -r functest_requirements.txt\"" >> .github/workflows/scripts/script.sh + echo "vagrant ssh \$1 -c \"workon pulp && cd devel/pulp_python/ && pytest -v -r sx --color=yes --pyargs pulp_python.tests.functional\"" >> .github/workflows/scripts/script.sh + .github/workflows/scripts/script.sh ${{ matrix.test_type }} + env: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + - name: After failure + if: failure() + run: | + cd ../pulp_installer + .github/workflows/scripts/after_failure.sh ${{ matrix.test_type }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ea6413d3..18d8b66b 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -146,3 +146,4 @@ jobs: docker logs pulp || true docker exec pulp ls -latr /etc/yum.repos.d/ || true docker exec pulp cat /etc/yum.repos.d/* || true + docker exec pulp pip3 list diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1cbcfa0..55fe87e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,3 +138,4 @@ jobs: docker logs pulp || true docker exec pulp ls -latr /etc/yum.repos.d/ || true docker exec pulp cat /etc/yum.repos.d/* || true + docker exec pulp pip3 list diff --git a/.github/workflows/scripts/install.sh b/.github/workflows/scripts/install.sh index 29cdb94a..a63cd034 100755 --- a/.github/workflows/scripts/install.sh +++ b/.github/workflows/scripts/install.sh @@ -13,6 +13,8 @@ REPO_ROOT="$PWD" set -euv +source .github/workflows/scripts/utils.sh + if [ "${GITHUB_REF##refs/tags/}" = "${GITHUB_REF}" ] then TAG_BUILD=0 @@ -75,12 +77,9 @@ cat >> vars/main.yaml << VARSYAML pulp_settings: null VARSYAML -if [[ "$TEST" == "pulp" || "$TEST" == "performance" || "$TEST" == "s3" || "$TEST" == "plugin-from-pypi" ]]; then - sed -i -e '/^services:/a \ - - name: pulp-fixtures\ - image: docker.io/pulp/pulp-fixtures:latest\ - env: {BASE_URL: "http://pulp-fixtures:8080"}' vars/main.yaml -fi - ansible-playbook build_container.yaml ansible-playbook start_container.yaml + +echo ::group::PIP_LIST +cmd_prefix bash -c "pip3 list && pip3 install pipdeptree && pipdeptree" +echo ::endgroup:: diff --git a/.github/workflows/scripts/utils.sh b/.github/workflows/scripts/utils.sh index 5fe83171..a60cb012 100755 --- a/.github/workflows/scripts/utils.sh +++ b/.github/workflows/scripts/utils.sh @@ -7,14 +7,14 @@ # # For more info visit https://github.com/pulp/plugin_template -PULP_CONTAINER=pulp +PULP_CI_CONTAINER=pulp # Run a command cmd_prefix() { - docker exec "$PULP_CONTAINER" "$@" + docker exec "$PULP_CI_CONTAINER" "$@" } # Run a command, and pass STDIN cmd_stdin_prefix() { - docker exec -i "$PULP_CONTAINER" "$@" + docker exec -i "$PULP_CI_CONTAINER" "$@" } diff --git a/template_config.yml b/template_config.yml index b47ad8a6..85c55805 100644 --- a/template_config.yml +++ b/template_config.yml @@ -4,6 +4,7 @@ additional_plugins: [] black: false check_commit_message: true +check_gettext: true check_manifest: true check_stray_pulpcore_imports: true cherry_pick_automation: false @@ -22,6 +23,7 @@ plugin_caps: PULP_PYTHON plugin_caps_short: PYTHON plugin_dash: pulp-python plugin_dash_short: python +plugin_default_branch: master plugin_name: pulp_python plugin_snake: pulp_python publish_docs_to_pulpprojectdotorg: false @@ -35,6 +37,7 @@ redmine_project: null stable_branch: null test_bindings: false test_cli: false +test_fips_nightly: false test_performance: false test_released_plugin_with_next_pulpcore_release: false test_s3: false