Skip to content

Commit

Permalink
allow common-utils to be installed on "minimal" RHEL-based distributi…
Browse files Browse the repository at this point in the history
…ons (#811)

* allow common-utils to be installed on "minimal" RHEL-based distributions.

* bump version to reflect bug fix

* add missing test scripts for alma scenarios

---------

Co-authored-by: Jeff Putsch <[email protected]>
  • Loading branch information
jdputschadi and Jeff Putsch authored Jan 26, 2024
1 parent 4697d25 commit 3e0c0ae
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/common-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "common-utils",
"version": "2.4.0",
"version": "2.4.1",
"name": "Common Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
Expand Down Expand Up @@ -66,4 +66,4 @@
"description": "Add packages from non-free Debian repository? (Debian only)"
}
}
}
}
9 changes: 6 additions & 3 deletions src/common-utils/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,12 @@ install_debian_packages() {
install_redhat_packages() {
local package_list=""
local remove_epel="false"
local install_cmd=dnf
if ! type dnf > /dev/null 2>&1; then
install_cmd=yum
local install_cmd=microdnf
if ! type microdnf > /dev/null 2>&1; then
install_cmd=dnf
if ! type dnf > /dev/null 2>&1; then
install_cmd=yum
fi
fi

if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
Expand Down
16 changes: 16 additions & 0 deletions test/common-utils/alma-8-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el8"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/alma-8.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el8"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/alma-9-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el9"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/alma-9.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el9"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/rocky-8-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el8"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
16 changes: 16 additions & 0 deletions test/common-utils/rocky-9-minimal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
. /etc/os-release
check "non-root user" test "$(whoami)" = "devcontainer"
check "distro" test "${PLATFORM_ID}" = "platform:el9"
check "curl" curl --version
check "jq" jq --version

# Report result
reportResults
44 changes: 43 additions & 1 deletion test/common-utils/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,34 @@
"common-utils": {}
}
},
"alma-8": {
"image": "almalinux:8",
"remoteUser": "devcontainer",
"features": {
"common-utils": {}
}
},
"alma-9": {
"image": "almalinux:9",
"remoteUser": "devcontainer",
"features": {
"common-utils": {}
}
},
"alma-8-minimal": {
"image": "almalinux:8-minimal",
"remoteUser": "devcontainer",
"features": {
"common-utils": {}
}
},
"alma-9-minimal": {
"image": "almalinux:9-minimal",
"remoteUser": "devcontainer",
"features": {
"common-utils": {}
}
},
"rocky-8": {
"image": "rockylinux:8",
"remoteUser": "devcontainer",
Expand All @@ -55,6 +83,20 @@
"common-utils": {}
}
},
"rocky-8-minimal": {
"image": "rockylinux:8-minimal",
"remoteUser": "devcontainer",
"features": {
"common-utils": {}
}
},
"rocky-9-minimal": {
"image": "rockylinux:9-minimal",
"remoteUser": "devcontainer",
"features": {
"common-utils": {}
}
},
"fedora": {
"image": "fedora",
"remoteUser": "devcontainer",
Expand Down Expand Up @@ -209,4 +251,4 @@
"common-utils": {}
}
}
}
}

0 comments on commit 3e0c0ae

Please sign in to comment.