Merge pull request #66930 from dwoz/merge/3007.x/3006.x

[3007.x] Merge forward 3006.x into 3007.x
This commit is contained in:
Daniel Wozniak 2024-09-30 12:53:16 -07:00 committed by GitHub
commit ef3d8f7840
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 124 additions and 243 deletions

View file

@ -448,7 +448,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-salt-onedir:
@ -464,7 +464,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-pkgs-onedir:
@ -477,7 +477,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "onedir"
@ -491,7 +491,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "src"
build-ci-deps:

View file

@ -505,7 +505,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-salt-onedir:
@ -521,7 +521,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-pkgs-onedir:
@ -534,7 +534,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "onedir"
environment: nightly
@ -552,7 +552,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "src"
environment: nightly
@ -3086,65 +3086,6 @@ jobs:
id: get-workflow-info
uses: im-open/workflow-conclusion@v2
- name: Notify Slack
id: slack
if: always()
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"attachments": [
{
"fallback": "${{ github.workflow }} Workflow build result for the `${{ github.ref_name }}` branch(attempt: ${{ github.run_attempt }}): `${{ steps.get-workflow-info.outputs.conclusion }}`\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": "${{ steps.get-workflow-info.outputs.conclusion != 'success' && 'ff3d00' || '00e676' }}",
"fields": [
{
"title": "Workflow",
"short": true,
"value": "${{ github.workflow }}",
"type": "mrkdwn"
},
{
"title": "Workflow Run",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>",
"type": "mrkdwn"
},
{
"title": "Branch",
"short": true,
"value": "${{ github.ref_name }}",
"type": "mrkdwn"
},
{
"title": "Commit",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>",
"type": "mrkdwn"
},
{
"title": "Attempt",
"short": true,
"value": "${{ github.run_attempt }}",
"type": "mrkdwn"
},
{
"title": "Status",
"short": true,
"value": "${{ steps.get-workflow-info.outputs.conclusion }}",
"type": "mrkdwn"
}
],
"author_name": "${{ github.event.sender.login }}",
"author_link": "${{ github.event.sender.html_url }}",
"author_icon": "${{ github.event.sender.avatar_url }}"
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Set Pipeline Exit Status
shell: bash
run: |

View file

@ -495,7 +495,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-salt-onedir:
@ -511,7 +511,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-pkgs-onedir:
@ -524,7 +524,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "onedir"
@ -538,7 +538,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "src"
build-ci-deps:

View file

@ -487,7 +487,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-salt-onedir:
@ -503,7 +503,7 @@ jobs:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
self-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['self-hosted'] }}
github-hosted-runners: ${{ fromJSON(needs.prepare-workflow.outputs.runners)['github-hosted'] }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
build-pkgs-onedir:
@ -516,7 +516,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "onedir"
environment: staging
@ -534,7 +534,7 @@ jobs:
with:
salt-version: "${{ needs.prepare-workflow.outputs.salt-version }}"
cache-prefix: ${{ needs.prepare-workflow.outputs.cache-seed }}
relenv-version: "0.17.0"
relenv-version: "0.17.2"
python-version: "3.10.14"
source: "src"
environment: staging

View file

@ -51,81 +51,6 @@ concurrency:
<%- include "workflow-requirements-check.yml.jinja" %>
<%- include "trigger-branch-workflows.yml.jinja" %>
{#- When we start using a slack app, we can update messages, not while using incoming webhooks
<%- if workflow_slug == "nightly" %>
<%- do conclusion_needs.append('notify-slack') %>
notify-slack:
name: Notify Slack
runs-on: ubuntu-latest
environment: <{ gh_environment }>
needs:
<%- for need in prepare_workflow_needs.iter(consume=False) %>
- <{ need }>
<%- endfor %>
outputs:
update-ts: ${{ steps.slack.outputs.update-ts }}
steps:
- name: Notify Slack
id: slack
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"attachments": [
{
"color": "ffca28",
"fields": [
{
"title": "Workflow",
"short": true,
"value": "${{ github.workflow }}",
"type": "mrkdwn"
},
{
"title": "Workflow Run",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>",
"type": "mrkdwn"
},
{
"title": "Branch",
"short": true,
"value": "${{ github.ref_name }}",
"type": "mrkdwn"
},
{
"title": "Commit",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>",
"type": "mrkdwn"
},
{
"title": "Attempt",
"short": true,
"value": "${{ github.run_attempt }}",
"type": "mrkdwn"
},
{
"title": "Status",
"short": true,
"value": "running",
"type": "mrkdwn"
}
],
"author_name": "${{ github.event.sender.login }}",
"author_link": "${{ github.event.sender.html_url }}",
"author_icon": "${{ github.event.sender.avatar_url }}"
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
<%- endif %>
#}
<%- endblock pre_jobs %>
<%- block jobs %>
@ -195,73 +120,3 @@ concurrency:
tools pkg repo publish <{ gh_environment }> --salt-version=${{ needs.prepare-workflow.outputs.salt-version }} artifacts/pkgs/repo/
<%- endblock jobs %>
<%- block set_pipeline_exit_status_extra_steps %>
<%- if workflow_slug == "nightly" %>
- name: Notify Slack
id: slack
if: always()
uses: slackapi/slack-github-action@v1.24.0
with:
{#- When we start using a slack app, we can update messages, not while using incoming webhooks
update-ts: ${{ needs.notify-slack.outputs.update-ts }}
#}
payload: |
{
"attachments": [
{
"fallback": "${{ github.workflow }} Workflow build result for the `${{ github.ref_name }}` branch(attempt: ${{ github.run_attempt }}): `${{ steps.get-workflow-info.outputs.conclusion }}`\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"color": "${{ steps.get-workflow-info.outputs.conclusion != 'success' && 'ff3d00' || '00e676' }}",
"fields": [
{
"title": "Workflow",
"short": true,
"value": "${{ github.workflow }}",
"type": "mrkdwn"
},
{
"title": "Workflow Run",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.run_id }}>",
"type": "mrkdwn"
},
{
"title": "Branch",
"short": true,
"value": "${{ github.ref_name }}",
"type": "mrkdwn"
},
{
"title": "Commit",
"short": true,
"value": "<${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|${{ github.sha }}>",
"type": "mrkdwn"
},
{
"title": "Attempt",
"short": true,
"value": "${{ github.run_attempt }}",
"type": "mrkdwn"
},
{
"title": "Status",
"short": true,
"value": "${{ steps.get-workflow-info.outputs.conclusion }}",
"type": "mrkdwn"
}
],
"author_name": "${{ github.event.sender.login }}",
"author_link": "${{ github.event.sender.html_url }}",
"author_icon": "${{ github.event.sender.avatar_url }}"
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
<%- endif %>
<%- endblock set_pipeline_exit_status_extra_steps %>

1
changelog/66856.fixed.md Normal file
View file

@ -0,0 +1 @@
Better handling output of `systemctl --version` with salt.grains.core._systemd

1
changelog/66858.fixed.md Normal file
View file

@ -0,0 +1 @@
Upgrade relenv to 0.17.2. This release includes openssl 3.2.3 and fixes for pip 24.2.

View file

@ -1,6 +1,6 @@
nox_version: "2022.8.7"
python_version: "3.10.14"
relenv_version: "0.17.0"
relenv_version: "0.17.2"
release_branches:
- "3006.x"
- "3007.x"

View file

@ -65,8 +65,11 @@ class DeferredStreamHandler(StreamHandler):
super().handle(record)
finally:
self.__emitting = False
# This will raise a ValueError if the file handle has been closed.
super().flush()
# Seeing an exception from calling flush on a closed file in the test
# suite. Handling this condition for now but this seems to be
# indicitive of an un-clean teardown at some point.
if not self.stream.closed:
super().flush()
def sync_with_handlers(self, handlers=()):
"""

View file

@ -2518,10 +2518,31 @@ def _systemd():
"""
Return the systemd grain
"""
systemd_info = __salt__["cmd.run"]("systemctl --version").splitlines()
systemd_version = "UNDEFINED"
systemd_features = ""
try:
systemd_output = __salt__["cmd.run_all"]("systemctl --version")
except Exception: # pylint: disable=broad-except
log.error("Exception while executing `systemctl --version`", exc_info=True)
return {
"version": systemd_version,
"features": systemd_features,
}
if systemd_output.get("retcode") == 0:
systemd_info = systemd_output.get("stdout", "").splitlines()
try:
if systemd_info[0].startswith("systemd "):
systemd_version = systemd_info[0].split()[1]
systemd_features = systemd_info[1]
except IndexError:
pass
if systemd_version == "UNDEFINED" or systemd_features == "":
log.error(
"Unexpected output returned by `systemctl --version`: %s", systemd_output
)
return {
"version": systemd_info[0].split()[1],
"features": systemd_info[1],
"version": systemd_version,
"features": systemd_features,
}

View file

@ -4188,34 +4188,93 @@ def test__selinux():
assert ret == {"enabled": True, "enforced": "Disabled"}
def test__systemd():
@pytest.mark.parametrize(
"systemd_data,expected",
(
(
{
"pid": 1234,
"retcode": 0,
"stdout": "systemd 254 (254.3-1)\n+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK "
"+SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS "
"+FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 "
"-PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD "
"+BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified",
"stderr": "",
},
{
"version": "254",
"features": "+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL "
"+ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP "
"+LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ "
"+ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified",
},
),
(
{
"pid": 2345,
"retcode": 1,
"stdout": "",
"stderr": "some garbage in the output",
},
{
"version": "UNDEFINED",
"features": "",
},
),
(
{
"pid": 3456,
"retcode": 0,
"stdout": "unexpected stdout\none more line",
"stderr": "",
},
{
"version": "UNDEFINED",
"features": "",
},
),
(
{
"pid": 4567,
"retcode": 0,
"stdout": "",
"stderr": "",
},
{
"version": "UNDEFINED",
"features": "",
},
),
(
Exception("Some exception on calling `systemctl --version`"),
{
"version": "UNDEFINED",
"features": "",
},
),
),
)
def test__systemd(systemd_data, expected):
"""
test _systemd
"""
def mock_run_all_systemd(_):
if isinstance(systemd_data, Exception):
raise systemd_data
return systemd_data
with patch.dict(
core.__salt__,
{
"cmd.run": MagicMock(
return_value=(
"systemd 254 (254.3-1)\n+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK "
"+SECCOMP +GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS "
"+FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 "
"-PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD "
"+BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified"
)
),
"cmd.run_all": mock_run_all_systemd,
},
):
ret = core._systemd()
assert "version" in ret
assert "features" in ret
assert ret["version"] == "254"
assert ret["features"] == (
"+PAM +AUDIT -SELINUX -APPARMOR -IMA +SMACK +SECCOMP +GCRYPT +GNUTLS +OPENSSL "
"+ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP "
"+LIBFDISK +PCRE2 -PWQUALITY +P11KIT -QRENCODE +TPM2 +BZIP2 +LZ4 +XZ "
"+ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP -SYSVINIT default-hierarchy=unified"
)
assert ret == expected
def test__clean_value_uuid(caplog):