-
Notifications
You must be signed in to change notification settings - Fork 278
feat: onboard ubuntu2604 cvm #9385
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
Merged
Merged
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
0e0e742
fix
zachary-bailey c2a5a26
fix
zachary-bailey 8062e4b
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey d376387
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 5ee6476
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 2e171fe
fix
zachary-bailey 8bb8798
fix
zachary-bailey 225a208
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey da0ab43
fix
zachary-bailey 2e5faf9
fix
zachary-bailey 91fd820
fix
zachary-bailey 90558a6
fix
zachary-bailey 6a84560
fix
zachary-bailey 794e3f5
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 67c56cf
fix
zachary-bailey 9a298a4
fix
zachary-bailey 14dae51
fox
zachary-bailey 7a7f2f8
fix
zachary-bailey 56d56d8
fix
zachary-bailey 19c0701
fix
zachary-bailey ccbb668
fix
zachary-bailey 2b743e8
fix
zachary-bailey 6155e9b
fix
zachary-bailey 5b84138
fix
zachary-bailey fdccef1
fix
zachary-bailey 5ca4363
fix
zachary-bailey f66466f
fix
zachary-bailey f3dc86b
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 8444401
fix
zachary-bailey dd4fc0e
fix
zachary-bailey 6ebef66
fix
zachary-bailey 4d34211
fix
zachary-bailey 2ee58b9
fix
zachary-bailey c28f7f3
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 7a46e4c
fix
zachary-bailey b4a9c99
fix
zachary-bailey 59d8665
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey f8b6d9d
fix
zachary-bailey 6cc30f4
fix
zachary-bailey fc88eda
fix
zachary-bailey 46490c7
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 40cccee
fix
zachary-bailey 9b0a880
fix
zachary-bailey f681ef5
fix
zachary-bailey 9888e73
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 6150ab0
fix
zachary-bailey e0a8650
fix
zachary-bailey ca6cbd5
fix
zachary-bailey 7e1a57d
fix
zachary-bailey 7b85cf9
fix
zachary-bailey bfd1e7c
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey dc51d9f
fix
zachary-bailey ab2aced
Merge branch 'main' into zb/onboard2604CVM
zachary-bailey 02360bd
fix
zachary-bailey f35862c
fix
zachary-bailey 70c6976
fix
zachary-bailey 556d47a
fix
zachary-bailey 3c54d70
fix
zachary-bailey 2c041cc
fix
zachary-bailey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| #!/bin/bash | ||
|
|
||
| # shellcheck disable=SC1090,SC2329 | ||
|
|
||
| Describe 'trim-2604-cvm-packages' | ||
| TRIM_SCRIPT="./vhdbuilder/packer/ubuntu-2604-cvm/trim-2604-cvm-packages.sh" | ||
|
|
||
| setup_trim() { | ||
| TEST_DIR="$(mktemp -d)" | ||
| source "${TRIM_SCRIPT}" | ||
| MARKED_FOR_REMOVAL_PACKAGES_FILE="${TEST_DIR}/marked-for-removal-packages.txt" | ||
| REQUIRED_PACKAGES_FILE="${TEST_DIR}/required-packages.txt" | ||
| FINAL_REQUIRED_PACKAGES_FILE="${TEST_DIR}/final-required-packages.txt" | ||
| FINAL_FORBIDDEN_PACKAGES_FILE="${TEST_DIR}/final-forbidden-packages.txt" | ||
| } | ||
|
|
||
| cleanup_trim() { | ||
| rm -rf "${TEST_DIR}" | ||
| } | ||
|
|
||
| BeforeEach 'setup_trim' | ||
| AfterEach 'cleanup_trim' | ||
|
|
||
| It 'filters comments and absent packages before purging' | ||
| printf '%s\n' '# comment' remove-me absent-package '' > "${MARKED_FOR_REMOVAL_PACKAGES_FILE}" | ||
| printf '%s\n' required-package > "${REQUIRED_PACKAGES_FILE}" | ||
|
|
||
| dpkg-query() { | ||
| for argument in "$@"; do | ||
| package="${argument}" | ||
| done | ||
| case "${package}" in | ||
| remove-me|required-package) | ||
| echo installed | ||
| ;; | ||
| *) | ||
| return 1 | ||
| ;; | ||
| esac | ||
| } | ||
| apt-get() { echo "apt-get $*"; } | ||
| apt-mark() { echo "apt-mark $*"; } | ||
|
|
||
| When call main | ||
| The status should be success | ||
| The output should include "Purging 1 installed server-cvm packages marked for removal" | ||
| The output should include "apt-get -o DPkg::Lock::Timeout=300 purge -y --no-auto-remove --allow-remove-essential remove-me" | ||
| The output should not include "allow-remove-essential absent-package" | ||
| The output should include "apt-mark manual cron curl gpg jq logrotate rsyslog sudo xfsprogs" | ||
| The output should not include "apt-mark manual cron curl gpg jq logrotate rsyslog sudo xfsprogs tcpdump" | ||
| End | ||
|
|
||
| It 'marks installed tcpdump runtime packages as manual' | ||
| printf '%s\n' remove-me > "${MARKED_FOR_REMOVAL_PACKAGES_FILE}" | ||
| printf '%s\n' required-package > "${REQUIRED_PACKAGES_FILE}" | ||
|
|
||
| dpkg-query() { | ||
| for argument in "$@"; do | ||
| package="${argument}" | ||
| done | ||
| case "${package}" in | ||
| remove-me|required-package|libc6|libpcap0.8t64|libssl3t64|systemd|tcpdump) | ||
| echo installed | ||
| ;; | ||
| *) | ||
| return 1 | ||
| ;; | ||
| esac | ||
| } | ||
| apt-get() { return 0; } | ||
| apt-mark() { echo "apt-mark $*"; } | ||
|
|
||
| When call main | ||
| The status should be success | ||
| The output should include "apt-mark manual cron curl gpg jq logrotate rsyslog sudo xfsprogs libc6 libpcap0.8t64 libssl3t64 systemd tcpdump" | ||
| End | ||
|
|
||
| It 'fails when the removal list is empty' | ||
| : > "${MARKED_FOR_REMOVAL_PACKAGES_FILE}" | ||
| printf '%s\n' required-package > "${REQUIRED_PACKAGES_FILE}" | ||
|
|
||
| When call main | ||
| The status should be failure | ||
| The error should include "Marked-for-removal package list is missing or empty" | ||
| End | ||
|
|
||
| It 'fails when a required package is missing after trimming' | ||
| printf '%s\n' absent-package > "${MARKED_FOR_REMOVAL_PACKAGES_FILE}" | ||
| printf '%s\n' required-package > "${REQUIRED_PACKAGES_FILE}" | ||
|
|
||
| dpkg-query() { return 1; } | ||
| apt-mark() { return 0; } | ||
|
|
||
| When call main | ||
| The status should be failure | ||
| The output should include "No installed server-cvm packages marked for removal were found" | ||
| The error should include "Required CVM package pattern is not installed: required-package" | ||
| End | ||
|
|
||
| It 'supports final verification without running another purge' | ||
| printf '%s\n' remove-me > "${MARKED_FOR_REMOVAL_PACKAGES_FILE}" | ||
| printf '%s\n' initial-required-package > "${REQUIRED_PACKAGES_FILE}" | ||
| printf '%s\n' final-required-package > "${FINAL_REQUIRED_PACKAGES_FILE}" | ||
| printf '%s\n' forbidden-package > "${FINAL_FORBIDDEN_PACKAGES_FILE}" | ||
|
|
||
| dpkg-query() { | ||
| for argument in "$@"; do | ||
| package="${argument}" | ||
| done | ||
| [ "${package}" = "final-required-package" ] && echo installed | ||
| } | ||
| apt-get() { | ||
| echo "unexpected apt-get" | ||
| return 1 | ||
| } | ||
| apt-mark() { | ||
| echo "unexpected apt-mark" | ||
| return 1 | ||
| } | ||
|
|
||
| When call main --verify-only | ||
| The status should be success | ||
| The output should not include "unexpected" | ||
| End | ||
|
|
||
| It 'fails final verification when a forbidden vanilla package is installed' | ||
| printf '%s\n' final-required-package > "${FINAL_REQUIRED_PACKAGES_FILE}" | ||
| printf '%s\n' vanilla-package > "${FINAL_FORBIDDEN_PACKAGES_FILE}" | ||
|
|
||
| dpkg-query() { | ||
| for argument in "$@"; do | ||
| package="${argument}" | ||
| done | ||
| case "${package}" in | ||
| final-required-package|vanilla-package) | ||
| echo installed | ||
| ;; | ||
| esac | ||
| } | ||
|
|
||
| When call main --verify-only | ||
| The status should be failure | ||
| The error should include "Forbidden CVM package pattern is installed: vanilla-package" | ||
| End | ||
|
|
||
| It 'fails final verification when the required package list is empty' | ||
| : > "${FINAL_REQUIRED_PACKAGES_FILE}" | ||
|
|
||
| When call main --verify-only | ||
| The status should be failure | ||
| The error should include "Required package list is missing or empty" | ||
| End | ||
|
|
||
| It 'fails final verification when the forbidden package list is empty' | ||
| printf '%s\n' final-required-package > "${FINAL_REQUIRED_PACKAGES_FILE}" | ||
| : > "${FINAL_FORBIDDEN_PACKAGES_FILE}" | ||
|
|
||
| dpkg-query() { | ||
| echo installed | ||
| } | ||
|
|
||
| When call main --verify-only | ||
| The status should be failure | ||
| The error should include "Forbidden package list is missing or empty" | ||
| End | ||
|
|
||
| It 'rejects unknown arguments' | ||
| When call main --unknown | ||
| The status should be failure | ||
| The error should include "Unknown argument: --unknown" | ||
| End | ||
| End |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,13 @@ else | |
| apt_get_update || exit $ERR_APT_UPDATE_TIMEOUT | ||
| apt_get_dist_upgrade || exit $ERR_APT_DIST_UPGRADE_TIMEOUT | ||
|
|
||
| if isUbuntu "$OS" && | ||
| [ "$OS_VERSION" = "26.04" ] && | ||
| isMinimalImage && | ||
| grep -q "cvm" <<< "$FEATURE_FLAGS"; then | ||
| /bin/bash /home/packer/trim-2604-cvm-packages.sh | ||
|
zachary-bailey marked this conversation as resolved.
|
||
| fi | ||
|
|
||
| # shellcheck disable=SC3010 | ||
| if [[ "${ENABLE_FIPS,,}" == "true" ]]; then | ||
| # This is FIPS Install for Ubuntu, it purges non FIPS Kernel and attaches UA FIPS Updates | ||
|
|
@@ -177,13 +184,11 @@ if [[ ${UBUNTU_RELEASE//./} -ge 2204 && "${ENABLE_FIPS,,}" != "true" ]]; then | |
|
|
||
| # Choose kernel packages based on Ubuntu version and architecture | ||
| if grep -q "cvm" <<< "$FEATURE_FLAGS"; then | ||
| KERNEL_IMAGE="linux-image-azure-fde-lts-${UBUNTU_RELEASE}" | ||
| KERNEL_IMAGE="linux-azure-fde-lts-${UBUNTU_RELEASE}" | ||
| KERNEL_PACKAGES=( | ||
| "linux-image-azure-fde-lts-${UBUNTU_RELEASE}" | ||
| "linux-tools-azure-lts-${UBUNTU_RELEASE}" | ||
| "linux-cloud-tools-azure-lts-${UBUNTU_RELEASE}" | ||
| "linux-headers-azure-lts-${UBUNTU_RELEASE}" | ||
| "${KERNEL_IMAGE}" | ||
| ) | ||
|
zachary-bailey marked this conversation as resolved.
Comment on lines
186
to
190
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Zachary (@zachary-bailey) we confirmed this new logic works fine for other Ubuntu releases right? |
||
| MODULES_EXTRA_PKG="linux-modules-extra-azure-fde-lts-${UBUNTU_RELEASE}" | ||
| echo "Installing fde LTS kernel for CVM Ubuntu ${UBUNTU_RELEASE}" | ||
| else | ||
| # Use LTS kernel for other versions | ||
|
|
@@ -194,11 +199,11 @@ if [[ ${UBUNTU_RELEASE//./} -ge 2204 && "${ENABLE_FIPS,,}" != "true" ]]; then | |
| "linux-cloud-tools-azure-lts-${UBUNTU_RELEASE}" | ||
| "linux-headers-azure-lts-${UBUNTU_RELEASE}" | ||
| ) | ||
| MODULES_EXTRA_PKG="linux-modules-extra-azure-lts-${UBUNTU_RELEASE}" | ||
| echo "Installing LTS kernel for Ubuntu ${UBUNTU_RELEASE}" | ||
| fi | ||
|
|
||
| # Add modules-extra only when the package exists in the current apt repo | ||
| MODULES_EXTRA_PKG="linux-modules-extra-azure-lts-${UBUNTU_RELEASE}" | ||
| if apt-cache show "${MODULES_EXTRA_PKG}" &>/dev/null; then | ||
| KERNEL_PACKAGES+=("${MODULES_EXTRA_PKG}") | ||
| else | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.