Skip to content

Commit

Permalink
test bundle.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
manoj-nutanix committed Oct 1, 2024
1 parent 7682065 commit b5cbaef
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 32 deletions.
1 change: 1 addition & 0 deletions ansible/roles/containerd/tasks/redhat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
- container-selinux
when:
- ansible_distribution == 'OracleLinux'
- offline_mode_enabled

- name: install container-selinux rpm package
yum:
Expand Down
38 changes: 7 additions & 31 deletions bundles/oracle9.4/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,20 @@ set -euo pipefail
# of packages is not found. This makes yum return an error.
echo skip_missing_names_on_install=False >> /etc/yum.conf

# Check for Oracle Linux repositories
ORACLE_REPOS=${ORACLE_REPOS:-"ol9_baseos_latest,ol9_appstream,ol9_developer_EPEL"}

KUBERNETES_REPOS=${KUBERNETES_REPOS:-""}
if [[ -n "${KUBERNETES_REPOS}" ]]; then
ORACLE_REPOS="${ORACLE_REPOS},kubernetes"
fi

# Install required tools for repository creation
yum -y install epel-release gettext dnf-utils createrepo modulemd-tools yum-utils
yum clean all

TMP_DIR="$(mktemp -d repodata-XXXX)"
chmod 777 -R "${TMP_DIR}"
cp packages.txt "${TMP_DIR}"
pushd "${TMP_DIR}"

# Download package dependencies
# shellcheck disable=SC2046,SC2062,SC2063,SC2035
repoquery --archlist=x86_64,noarch --resolve --requires --recursive $(< packages.txt) | grep -v *.i686 >> reqs.txt
sed -i 1d reqs.txt # Remove the first line from the requirements file

# Download packages and dependencies
# shellcheck disable=SC2046
yumdownloader --archlist=x86_64,noarch \
--setopt=skip_missing_names_on_install=False -x \*i686 $(< reqs.txt)

yumdownloader --setopt=skip_missing_names_on_install=False -x \*i686 --archlist=x86_64,noarch \
--resolve --disablerepo=* --enablerepo="${ORACLE_REPOS}" \
$(< packages.txt)

# Clean up package and requirements files
rm packages.txt reqs.txt

# Create repository metadata and module information
createrepo -v .
repo2module . --module-name offline
createrepo_mod .

#shellcheck disable=SC2046
repoquery --archlist=x86_64,noarch --resolve --requires --recursive $(< packages.txt) | xargs -r yumdownloader --archlist=x86_64,noarch -x \*i686
#shellcheck disable=SC2046
yumdownloader --archlist=x86_64,noarch -x \*i686 $(< packages.txt)
rm packages.txt
createrepo -v . && chown -R 1000:1000 repodata/
# Package the repository into a tarball with proper permissions
# shellcheck disable=SC1083,SC2035
tar -czf {{ .OutputDirectory }}/{{ .KubernetesVersion }}_oraclelinux_9.4_x86_64{{ .FipsSuffix }}.tar.gz *
Expand Down
1 change: 1 addition & 0 deletions cmd/konvoy-image/cmd/create-package-bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
"rocky-9.1",
"ubuntu-18.04",
"ubuntu-20.04",
"oracle-9.4",
}
)

Expand Down
2 changes: 1 addition & 1 deletion docs/cli/konvoy-image_create-package-bundle.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ create-package-bundle --os redhat-8.4 --output-directory=artifacts
--fips If the package bundle should include fips packages.
-h, --help help for create-package-bundle
--kubernetes-version string The version of kubernetes to download packages for.
--os string The target OS you wish to create a package bundle for. Must be one of [centos-7.9 redhat-7.9 redhat-8.4 redhat-8.6 redhat-8.8 rocky-9.1 ubuntu-18.04 ubuntu-20.04]
--os string The target OS you wish to create a package bundle for. Must be one of [centos-7.9 redhat-7.9 redhat-8.4 redhat-8.6 redhat-8.8 rocky-9.1 ubuntu-18.04 ubuntu-20.04 oracle-9.4]
--output-directory string The directory to place the bundle in. (default "artifacts")
```

Expand Down

0 comments on commit b5cbaef

Please sign in to comment.