Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating container usage to that used in new Salt pipelines for CI/CD, fix Amazon Linux #2071

Merged
merged 14 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,36 @@ jobs:



amazonlinux-2023:
name: Amazon 2023
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: amazonlinux-2023
display-name: Amazon 2023
container-slug: amazonlinux-2023
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'


debian-11:
name: Debian 11
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
uses: ./.github/workflows/test-linux.yml
needs:
- lint
- generate-actions-workflow
with:
distro-slug: debian-11
display-name: Debian 11
container-slug: debian-11
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'


debian-12:
name: Debian 12
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
Expand All @@ -190,7 +220,7 @@ jobs:
with:
distro-slug: debian-12
display-name: Debian 12
container-slug: systemd-debian-12
container-slug: debian-12
timeout: 20
instances: '["stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'

Expand All @@ -205,7 +235,7 @@ jobs:
with:
distro-slug: photon-5
display-name: Photon OS 5
container-slug: systemd-photon-5
container-slug: photon-5
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'

Expand All @@ -220,7 +250,7 @@ jobs:
with:
distro-slug: rockylinux-8
display-name: Rocky Linux 8
container-slug: systemd-rockylinux-8
container-slug: rockylinux-8
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'

Expand All @@ -235,7 +265,7 @@ jobs:
with:
distro-slug: rockylinux-9
display-name: Rocky Linux 9
container-slug: systemd-rockylinux-9
container-slug: rockylinux-9
timeout: 20
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'

Expand All @@ -250,7 +280,7 @@ jobs:
with:
distro-slug: ubuntu-2204
display-name: Ubuntu 22.04
container-slug: systemd-ubuntu-22.04
container-slug: ubuntu-22.04
timeout: 20
instances: '["stable-3006", "git-3006", "onedir-3006", "stable-3006-8", "stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'

Expand All @@ -267,6 +297,8 @@ jobs:
- macos-13
- macos-14
- windows-2022
- amazonlinux-2023
- debian-11
- debian-12
- photon-5
- rockylinux-8
Expand Down
47 changes: 20 additions & 27 deletions .github/workflows/templates/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@

os.chdir(os.path.abspath(os.path.dirname(__file__)))

# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "debian-11",
# "debian-13",
# "fedora-40",
# "photon-4",
# "ubuntu-2004",
# "ubuntu-2404",
LINUX_DISTROS = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"photon-5",
"rockylinux-8",
Expand All @@ -34,44 +32,38 @@
"macos-14",
]

# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "debian-11",
# "debian-13",
# "fedora-40",
# "photon-4",
# "ubuntu-2004",
# "ubuntu-2404",
STABLE_DISTROS = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"photon-5",
"rockylinux-8",
"rockylinux-9",
"ubuntu-2204",
]

# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "debian-11",
# "debian-13",
# "fedora-40",
# "photon-4",
# "ubuntu-2004",
# "ubuntu-2404",
ONEDIR_DISTROS = [
"amazonlinux-2023",
"debian-11",
"debian-12",
"photon-5",
"rockylinux-8",
"rockylinux-9",
"ubuntu-2204",
]

# only test against current containers with systemd
# will add these when they become available with systemd
# "amazonlinux-2",
# "amazonlinux-2023",
# "photon-4",
Expand Down Expand Up @@ -102,6 +94,7 @@
"amazonlinux-2023",
"debian-11",
"debian-12",
"debian-13",
"fedora-40",
"photon-4",
"photon-5",
Expand Down Expand Up @@ -217,19 +210,19 @@
}

CONTAINER_SLUG_NAMES = {
"amazonlinux-2": "systemd-amazonlinux-2",
"amazonlinux-2023": "systemd-amazonlinux-2023",
"debian-11": "systemd-debian-11",
"debian-12": "systemd-debian-12",
"debian-13": "systemd-debian-13",
"fedora-40": "systemd-fedora-40",
"photon-4": "systemd-photon-4",
"photon-5": "systemd-photon-5",
"rockylinux-8": "systemd-rockylinux-8",
"rockylinux-9": "systemd-rockylinux-9",
"ubuntu-2004": "systemd-ubuntu-20.04",
"ubuntu-2204": "systemd-ubuntu-22.04",
"ubuntu-2404": "systemd-ubuntu-24.04",
"amazonlinux-2": "amazonlinux-2",
"amazonlinux-2023": "amazonlinux-2023",
"debian-11": "debian-11",
"debian-12": "debian-12",
"debian-13": "debian-13",
"fedora-40": "fedora-40",
"photon-4": "photon-4",
"photon-5": "photon-5",
"rockylinux-8": "rockylinux-8",
"rockylinux-9": "rockylinux-9",
"ubuntu-2004": "ubuntu-20.04",
"ubuntu-2204": "ubuntu-22.04",
"ubuntu-2404": "ubuntu-24.04",
"macos-12": "macos-12",
"macos-13": "macos-13",
"macos-14": "macOS 14",
Expand Down
40 changes: 24 additions & 16 deletions .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ jobs:
Test:
name: ${{ matrix.instance }}
runs-on: ubuntu-latest
container:
image: ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }}
options: --privileged

timeout-minutes: ${{ inputs.timeout }}
strategy:
max-parallel: 2
Expand All @@ -46,16 +42,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install Python Dependencies with pip breakage
if: ${{ ( inputs.distro-slug == 'debian-11' ) || ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }}
run: |
python3 -m pip install --break-system-packages -r tests/requirements.txt

- name: Install Python Dependencies without pip breakage
if: ${{ ( inputs.distro-slug != 'debian-11' ) && ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }}
run: |
python3 -m pip install -r tests/requirements.txt

- name: Get Version
run: |
# We need to get the version here and make it an environment variable
Expand All @@ -65,17 +51,39 @@ jobs:
vt_parm_ver=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}')
echo "SaltVersion=$vt_parm_ver" >> $GITHUB_ENV

- name: "Pull container ${{ inputs.container-slug }}"
run: |
docker pull ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }}

- name: "Create container ${{ inputs.container-slug }}"
run: |
/usr/bin/docker create --name ${{ github.run_id }}_salt-test --workdir /_w/ --privileged -e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -e $GITHUB_ENV -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work":"/__w" -v "/home/runner/work/_temp":"/__w/_temp" -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/salt-bootstrap/salt-bootstrap":"/_w/btstrap" --entrypoint "/usr/lib/systemd/systemd" ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }} --systemd --unit rescue.target

- name: "Start container ${{ inputs.container-slug }}"
run: |
/usr/bin/docker start ${{ github.run_id }}_salt-test

- name: "Install Python Dependencies with pip breakage in container ${{ inputs.container-slug }}"
if: ${{ ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }}
run: |
docker exec ${{ github.run_id}}_salt-test python3 -m pip install --break-system-packages -r /_w/btstrap/tests/requirements.txt

- name: "Install Python Dependencies without pip breakage in container ${{ inputs.container-slug }}"
if: ${{ ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }}
run: |
docker exec ${{ github.run_id}}_salt-test python3 -m pip install -r /_w/btstrap/tests/requirements.txt

- name: Bootstrap Salt
run: |
# sed 1st - becomes space, 2nd - becomes dot
bt_arg1=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $1}')
bt_arg2=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}')
echo "bt parms ,$bt_parms, bt_arg1 ,$bt_arg1, bt_arg2 ,$bt_arg2,"
sh -x ./bootstrap-salt.sh "$bt_arg1" "$bt_arg2"
docker exec ${{ github.run_id}}_salt-test sh -x /_w/btstrap/bootstrap-salt.sh "$bt_arg1" "$bt_arg2"

- name: Test Bootstrap
run: |
pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/
docker exec ${{ github.run_id}}_salt-test pytest --cache-clear -v -s -ra --log-cli-level=debug /_w/btstrap/tests/integration/

- name: Set Exit Status
if: always()
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
name: Rewrite Code to be Py3.9+
args: [--py39-plus]
name: Rewrite Code to be Py3.6+
args: [--py36-plus]
## DGM name: Rewrite Code to be Py3.9+
## DGM args: [--py39-plus]

- repo: https://github.com/asottile/reorder_python_imports
rev: v3.12.0
Expand Down
Loading
Loading