Skip to content

Commit b59e417

Browse files
committed
updates for build
1 parent 477ab21 commit b59e417

File tree

9 files changed

+356
-57
lines changed

9 files changed

+356
-57
lines changed

.github/workflows/arm-local-build.yml

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ permissions:
2121
contents: read
2222

2323
jobs:
24-
build-ubuntu24-raw:
24+
build-ubuntu24-arm-raw:
2525
runs-on: ubuntu-24.04-arm
2626
steps:
2727
- name: Checkout code
@@ -41,7 +41,7 @@ jobs:
4141
- name: Install system deps
4242
run: |
4343
sudo apt-get update
44-
sudo apt-get install -y qemu-system-x86 ovmf tree jq systemd-ukify mmdebstrap systemd-boot
44+
sudo apt-get install -y qemu-system-aarch64 ovmf tree jq systemd-ukify mmdebstrap systemd-boot
4545
4646
- name: Set up Go
4747
uses: actions/setup-go@v5
@@ -50,54 +50,54 @@ jobs:
5050

5151
- name: Prepare build script
5252
run: |
53-
if [ ! -f scripts/build_ubuntu24_raw.sh ]; then
54-
echo "scripts/build_ubuntu24_raw.sh not found!"
53+
if [ ! -f scripts/build_ubuntu24_arm_raw.sh ]; then
54+
echo "scripts/build_ubuntu24_arm_raw.sh not found!"
5555
exit 1
5656
fi
57-
chmod +x scripts/build_ubuntu24_raw.sh
57+
chmod +x scripts/build_ubuntu24_arm_raw.sh
5858
59-
# - name: Run Ubuntu24 Raw Image Build
60-
# env:
61-
# RUN_QEMU_TEST: ${{ github.event.inputs.run_qemu_test }}
62-
# run: |
63-
# echo "Starting Ubuntu24 raw image build..."
64-
# # Ensure script has access to docker group for Earthly
65-
# sudo usermod -aG docker $USER
66-
#
67-
# # Prepare arguments with input validation
68-
# ARGS=""
69-
# case "${RUN_QEMU_TEST}" in
70-
# "true")
71-
# ARGS="--qemu-test"
72-
# echo "QEMU boot test will be run after build"
73-
# ;;
74-
# "false"|"")
75-
# echo "QEMU boot test will be skipped"
76-
# ;;
77-
# *)
78-
# echo "Invalid input for run_qemu_test: ${RUN_QEMU_TEST}"
79-
# exit 1
80-
# ;;
81-
# esac
82-
#
83-
# # Run the Ubuntu24 raw image build script
84-
# ./scripts/build_ubuntu24_raw.sh $ARGS
85-
# echo "Ubuntu24 raw image build completed."
86-
#
87-
# - name: Notify on failure
88-
# if: ${{ failure() && github.event_name == 'pull_request' }}
89-
# env:
90-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91-
# REVIEWER_ID: srmungar
92-
# run: |
93-
# PR_AUTHOR=$(jq --raw-output 'try .pull_request.user.login // empty' "$GITHUB_EVENT_PATH")
94-
# if [ -z "$PR_AUTHOR" ]; then
95-
# echo "PR_AUTHOR not found in event payload. Skipping notification."
96-
# exit 0
97-
# fi
98-
# COMMENT_BODY="Hey @$PR_AUTHOR and @$REVIEWER_ID — the Ubuntu24 raw image build has failed. Please check the logs."
99-
# curl -s -X POST \
100-
# -H "Authorization: Bearer $GITHUB_TOKEN" \
101-
# -H "Accept: application/vnd.github.v3+json" \
102-
# --data "{\"body\": \"$COMMENT_BODY\"}" \
103-
# "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
59+
- name: Run Ubuntu24 Raw Image Build
60+
env:
61+
RUN_QEMU_TEST: ${{ github.event.inputs.run_qemu_test }}
62+
run: |
63+
echo "Starting Ubuntu24 raw image build..."
64+
# Ensure script has access to docker group for Earthly
65+
sudo usermod -aG docker $USER
66+
67+
# Prepare arguments with input validation
68+
ARGS=""
69+
case "${RUN_QEMU_TEST}" in
70+
"true")
71+
ARGS="--qemu-test"
72+
echo "QEMU boot test will be run after build"
73+
;;
74+
"false"|"")
75+
echo "QEMU boot test will be skipped"
76+
;;
77+
*)
78+
echo "Invalid input for run_qemu_test: ${RUN_QEMU_TEST}"
79+
exit 1
80+
;;
81+
esac
82+
83+
# Run the Ubuntu24 raw image build script
84+
./scripts/build_ubuntu24_arm_raw.sh $ARGS
85+
echo "Ubuntu24 raw image build completed."
86+
87+
- name: Notify on failure
88+
if: ${{ failure() && github.event_name == 'pull_request' }}
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
REVIEWER_ID: srmungar
92+
run: |
93+
PR_AUTHOR=$(jq --raw-output 'try .pull_request.user.login // empty' "$GITHUB_EVENT_PATH")
94+
if [ -z "$PR_AUTHOR" ]; then
95+
echo "PR_AUTHOR not found in event payload. Skipping notification."
96+
exit 0
97+
fi
98+
COMMENT_BODY="Hey @$PR_AUTHOR and @$REVIEWER_ID — the Ubuntu24 raw image build has failed. Please check the logs."
99+
curl -s -X POST \
100+
-H "Authorization: Bearer $GITHUB_TOKEN" \
101+
-H "Accept: application/vnd.github.v3+json" \
102+
--data "{\"body\": \"$COMMENT_BODY\"}" \
103+
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"

config/osv/ubuntu/ubuntu24/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ x86_64:
77
pkgType: deb # Package management system
88
chrootenvConfigFile: chrootenvconfigs/chrootenv_x86_64.yml # Path to chrootenv config
99
releaseVersion: "24.04" # Distribution release version
10+
aarch64:
11+
dist: ubuntu24 # Distribution identifier
12+
arch: aarch64 # Target architecture
13+
pkgType: deb # Package management system
14+
chrootenvConfigFile: chrootenvconfigs/chrootenv_aarch64.yml # Path to chrootenv config
15+
releaseVersion: "24.04" # Distribution release version

internal/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,15 @@ func (t *ImageTemplate) GetPackageRepositories() []PackageRepository {
611611

612612
// LoadProviderRepoConfig loads provider repository configuration from YAML file
613613
// Returns a slice of ProviderRepoConfig to support multiple repositories
614-
func LoadProviderRepoConfig(targetOS, targetDist string) ([]ProviderRepoConfig, error) {
614+
func LoadProviderRepoConfig(targetOS, targetDist string, arch string) ([]ProviderRepoConfig, error) {
615615
// Get the target OS config directory
616616
targetOsConfigDir, err := GetTargetOsConfigDir(targetOS, targetDist)
617617
if err != nil {
618618
return nil, fmt.Errorf("failed to get target OS config directory: %w", err)
619619
}
620620

621621
// Construct path to repo.yml
622-
repoConfigPath := filepath.Join(targetOsConfigDir, "providerconfigs", "repo.yml")
622+
repoConfigPath := filepath.Join(targetOsConfigDir, "providerconfigs", arch+"_repo.yml")
623623

624624
// Read the YAML file
625625
yamlData, err := security.SafeReadFile(repoConfigPath, security.RejectSymlinks)

internal/ospackage/debutils/download.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,13 @@ func BuildRepoConfigs(userRepoList []Repository, arch string) ([]RepoConfig, err
129129
for _, localArch := range strings.Split(archs, ",") {
130130
package_list_url, err := GetPackagesNames(baseURL, codename, localArch, componentName)
131131
if err != nil {
132-
return nil, fmt.Errorf("getting package metadata name: %w", err)
132+
return nil, fmt.Errorf("getting package metadata name: %w, baseURL %s codename %s localArch %s componentName %s\n", err, baseURL, codename, localArch, componentName)
133133
}
134134
if package_list_url == "" {
135+
fmt.Printf("getting package metadata name: %w, baseURL %s codename %s localArch %s componentName %s\n", err, baseURL, codename, localArch, componentName)
135136
continue // No valid package list found for this arch/component
136137
}
138+
fmt.Printf("SUCCESS: baseURL %s codename %s localArch %s componentName %s\n", baseURL, codename, localArch, componentName)
137139
repo := RepoConfig{
138140
PkgList: package_list_url,
139141
ReleaseFile: fmt.Sprintf("%s/dists/%s/%s", baseURL, codename, releaseNm),

internal/provider/azl/azl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func (p *AzureLinux) downloadImagePkgs(template *config.ImageTemplate) error {
272272
// loadRepoConfigFromYAML loads repository configuration from centralized YAML config
273273
func loadRepoConfigFromYAML(dist, arch string) (rpmutils.RepoConfig, error) {
274274
// Load the centralized provider config
275-
providerConfigs, err := config.LoadProviderRepoConfig(OsName, dist)
275+
providerConfigs, err := config.LoadProviderRepoConfig(OsName, dist, arch)
276276
if err != nil {
277277
return rpmutils.RepoConfig{}, fmt.Errorf("failed to load provider repo config: %w", err)
278278
}

internal/provider/elxr/elxr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ func loadRepoConfig(repoUrl string, arch string) ([]debutils.RepoConfig, error)
280280
var repoConfigs []debutils.RepoConfig
281281

282282
// Load provider repo config for elxr - use correct OS name
283-
providerConfigs, err := config.LoadProviderRepoConfig(OsName, "elxr12") // Use "wind-river-elxr" and "aria" dist
283+
providerConfigs, err := config.LoadProviderRepoConfig(OsName, "elxr12", arch) // Use "wind-river-elxr" and "aria" dist
284284
if err != nil {
285285
return repoConfigs, fmt.Errorf("failed to load provider repo config: %w", err)
286286
}

internal/provider/emt/emt.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (p *Emt) downloadImagePkgs(template *config.ImageTemplate) error {
275275
// loadRepoConfigFromYAML loads repository configuration from centralized YAML config
276276
func loadRepoConfigFromYAML(dist, arch string) (rpmutils.RepoConfig, error) {
277277
// Load the centralized provider config
278-
providerConfigs, err := config.LoadProviderRepoConfig(OsName, dist)
278+
providerConfigs, err := config.LoadProviderRepoConfig(OsName, dist,arch)
279279
if err != nil {
280280
return rpmutils.RepoConfig{}, fmt.Errorf("failed to load provider repo config: %w", err)
281281
}

internal/provider/ubuntu/ubuntu.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ func (p *ubuntu) Init(dist, arch string) error {
5454
if arch == "x86_64" {
5555
arch = "amd64"
5656
}
57+
if arch == "aarch64" {
58+
arch="arm64"
59+
}
5760

5861
cfgs, err := loadRepoConfig("", arch) // repoURL no longer needed
5962
if err != nil {
@@ -248,7 +251,7 @@ func loadRepoConfig(repoUrl string, arch string) ([]debutils.RepoConfig, error)
248251
var repoConfigs []debutils.RepoConfig
249252

250253
// Load provider repo config using the centralized config function
251-
providerConfigs, err := config.LoadProviderRepoConfig(OsName, "ubuntu24")
254+
providerConfigs, err := config.LoadProviderRepoConfig(OsName, "ubuntu24", arch)
252255
if err != nil {
253256
return repoConfigs, fmt.Errorf("failed to load provider repo config: %w", err)
254257
}

0 commit comments

Comments
 (0)