From 18ea5cc561b69d1418e4cd83eca2ad3e9d851dfb Mon Sep 17 00:00:00 2001 From: Peter Braun Date: Mon, 3 Feb 2025 16:10:55 +0100 Subject: [PATCH] Use upload artifact v4 (#6807) unique-ify name psh, who needs loops Folder management Extracts into current path Co-authored-by: Alan Rominger --- .../actions/upload_awx_devel_logs/action.yml | 4 +-- .github/workflows/ci.yml | 28 +++++++++++++------ awx/main/fields.py | 2 +- .../0050_v340_drop_celery_tables.py | 4 +-- .../api/test_unified_jobs_stdout.py | 6 ++-- awx/main/tests/unit/utils/test_filters.py | 4 +-- awxkit/awxkit/utils/__init__.py | 4 +-- 7 files changed, 31 insertions(+), 21 deletions(-) diff --git a/.github/actions/upload_awx_devel_logs/action.yml b/.github/actions/upload_awx_devel_logs/action.yml index e8b80bc0a2..bad2cd34c3 100644 --- a/.github/actions/upload_awx_devel_logs/action.yml +++ b/.github/actions/upload_awx_devel_logs/action.yml @@ -13,7 +13,7 @@ runs: docker logs tools_awx_1 > ${{ inputs.log-filename }} - name: Upload AWX logs as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: docker-compose-logs + name: docker-compose-logs-${{ inputs.log-filename }} path: ${{ inputs.log-filename }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0dd93f0f94..6755ff24e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,7 @@ jobs: - name: Upload debug output if: failure() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: awx-operator-debug-output path: ${{ env.DEBUG_OUTPUT_DIR }} @@ -227,7 +227,7 @@ jobs: ANSIBLE_TEST_PREFER_PODMAN: 1 # Upload coverage report as artifact - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: name: coverage-${{ matrix.target-regex.name }} @@ -258,19 +258,29 @@ jobs: - name: Upgrade ansible-core run: python3 -m pip install --upgrade ansible-core - - name: Download coverage artifacts - uses: actions/download-artifact@v3 + - name: Download coverage artifacts A to H + uses: actions/download-artifact@v4 with: + name: coverage-a-h + path: coverage + + - name: Download coverage artifacts I to P + uses: actions/download-artifact@v4 + with: + name: coverage-i-p + path: coverage + + - name: Download coverage artifacts Z to Z + uses: actions/download-artifact@v4 + with: + name: coverage-r-z0-9 path: coverage - name: Combine coverage run: | make COLLECTION_VERSION=100.100.100-git install_collection mkdir -p ~/.ansible/collections/ansible_collections/awx/awx/tests/output/coverage - cd coverage - for i in coverage-*; do - cp -rv $i/* ~/.ansible/collections/ansible_collections/awx/awx/tests/output/coverage/ - done + cp -rv coverage/* ~/.ansible/collections/ansible_collections/awx/awx/tests/output/coverage/ cd ~/.ansible/collections/ansible_collections/awx/awx ansible-test coverage combine --requirements ansible-test coverage html @@ -323,7 +333,7 @@ jobs: done - name: Upload coverage report as artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: awx-collection-integration-coverage-html path: ~/.ansible/collections/ansible_collections/awx/awx/tests/output/reports/coverage diff --git a/awx/main/fields.py b/awx/main/fields.py index 7a74aadb3c..90dcc453fb 100644 --- a/awx/main/fields.py +++ b/awx/main/fields.py @@ -832,7 +832,7 @@ class CredentialTypeInjectorField(JSONSchemaField): 'type': 'string', # The environment variable _value_ can be any ascii, # but pexpect will choke on any unicode - 'pattern': '^[\x00-\x7F]*$', + 'pattern': '^[\x00-\x7f]*$', }, }, 'additionalProperties': False, diff --git a/awx/main/migrations/0050_v340_drop_celery_tables.py b/awx/main/migrations/0050_v340_drop_celery_tables.py index ce34d81ef3..2421c92d95 100644 --- a/awx/main/migrations/0050_v340_drop_celery_tables.py +++ b/awx/main/migrations/0050_v340_drop_celery_tables.py @@ -17,8 +17,8 @@ tables_to_drop = [ 'djkombu_message', 'djkombu_queue', ] -postgres_sql = ([("DROP TABLE IF EXISTS {} CASCADE;".format(table))] for table in tables_to_drop) -sqlite_sql = ([("DROP TABLE IF EXISTS {};".format(table))] for table in tables_to_drop) +postgres_sql = (["DROP TABLE IF EXISTS {} CASCADE;".format(table)] for table in tables_to_drop) +sqlite_sql = (["DROP TABLE IF EXISTS {};".format(table)] for table in tables_to_drop) class Migration(migrations.Migration): diff --git a/awx/main/tests/functional/api/test_unified_jobs_stdout.py b/awx/main/tests/functional/api/test_unified_jobs_stdout.py index 3dcef8f0e7..3565a73d77 100644 --- a/awx/main/tests/functional/api/test_unified_jobs_stdout.py +++ b/awx/main/tests/functional/api/test_unified_jobs_stdout.py @@ -83,7 +83,7 @@ def test_ansi_stdout_filtering(sqlite_copy, Parent, Child, relation, view, downl job = Parent() job.save() for i in range(3): - Child(**{relation: job, 'stdout': '\x1B[0;36mTesting {}\x1B[0m\n'.format(i), 'start_line': i}).save() + Child(**{relation: job, 'stdout': '\x1b[0;36mTesting {}\x1b[0m\n'.format(i), 'start_line': i}).save() url = reverse(view, kwargs={'pk': job.pk}) # ansi codes in ?format=txt should get filtered @@ -96,7 +96,7 @@ def test_ansi_stdout_filtering(sqlite_copy, Parent, Child, relation, view, downl # ask for ansi and you'll get it fmt = "?format={}".format("ansi_download" if download else "ansi") response = get(url + fmt, user=admin, expect=200) - assert smart_str(response.content).splitlines() == ['\x1B[0;36mTesting %d\x1B[0m' % i for i in range(3)] + assert smart_str(response.content).splitlines() == ['\x1b[0;36mTesting %d\x1b[0m' % i for i in range(3)] has_download_header = response.has_header('Content-Disposition') assert has_download_header if download else not has_download_header @@ -115,7 +115,7 @@ def test_colorized_html_stdout(sqlite_copy, Parent, Child, relation, view, get, job = Parent() job.save() for i in range(3): - Child(**{relation: job, 'stdout': '\x1B[0;36mTesting {}\x1B[0m\n'.format(i), 'start_line': i}).save() + Child(**{relation: job, 'stdout': '\x1b[0;36mTesting {}\x1b[0m\n'.format(i), 'start_line': i}).save() url = reverse(view, kwargs={'pk': job.pk}) + '?format=html' response = get(url, user=admin, expect=200) diff --git a/awx/main/tests/unit/utils/test_filters.py b/awx/main/tests/unit/utils/test_filters.py index 83d9da0e4f..c2b23de0ee 100644 --- a/awx/main/tests/unit/utils/test_filters.py +++ b/awx/main/tests/unit/utils/test_filters.py @@ -118,8 +118,8 @@ class TestSmartFilterQueryFromString: @pytest.mark.parametrize( "filter_string,q_expected", [ - (u'(a=abc\u1F5E3def)', Q(**{u"a": u"abc\u1F5E3def"})), - (u'(ansible_facts__a=abc\u1F5E3def)', Q(**{u"ansible_facts__contains": {u"a": u"abc\u1F5E3def"}})), + (u'(a=abc\u1f5e3def)', Q(**{u"a": u"abc\u1f5e3def"})), + (u'(ansible_facts__a=abc\u1f5e3def)', Q(**{u"ansible_facts__contains": {u"a": u"abc\u1f5e3def"}})), ], ) def test_unicode(self, mock_get_host_model, filter_string, q_expected): diff --git a/awxkit/awxkit/utils/__init__.py b/awxkit/awxkit/utils/__init__.py index b435b76430..772a21227f 100644 --- a/awxkit/awxkit/utils/__init__.py +++ b/awxkit/awxkit/utils/__init__.py @@ -266,9 +266,9 @@ def random_utf8(*args, **kwargs): exception when a character outside of the BMP is sent to `send_keys`. Code pulled from http://stackoverflow.com/a/3220210. """ - pattern = re.compile('[^\u0000-\uD7FF\uE000-\uFFFF]', re.UNICODE) + pattern = re.compile('[^\u0000-\ud7ff\ue000-\uffff]', re.UNICODE) length = args[0] if len(args) else kwargs.get('length', 10) - scrubbed = pattern.sub('\uFFFD', ''.join([gen_utf_char() for _ in range(length)])) + scrubbed = pattern.sub('\ufffd', ''.join([gen_utf_char() for _ in range(length)])) return scrubbed