mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Build Deb and RPM with the previously built Salt onedir
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
91bdd5f01b
commit
c9b9fd6b7d
5 changed files with 71 additions and 59 deletions
14
.github/workflows/build-deb-packages.yml
vendored
14
.github/workflows/build-deb-packages.yml
vendored
|
@ -17,6 +17,7 @@ jobs:
|
|||
- ${{ matrix.arch }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
arch:
|
||||
- x86_64
|
||||
|
@ -30,20 +31,27 @@ jobs:
|
|||
with:
|
||||
path: build-deb-pkg
|
||||
|
||||
- name: Download Onedir Tarball as an Artifact
|
||||
if: inputs.platform != 'windows' && steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: salt-linux-${{ matrix.arch }}.tar.xz
|
||||
path: build-deb-pkg/artifacts/
|
||||
|
||||
- name: Download System Dependencies
|
||||
run: |
|
||||
apt update
|
||||
apt install -y python3 python3-virtualenv build-essential devscripts debhelper bash-completion
|
||||
apt install -y python3 python3-venv build-essential devscripts debhelper bash-completion
|
||||
|
||||
- name: Build Deb
|
||||
env:
|
||||
USE_STATIC_REQUIREMENTS: "1"
|
||||
SALT_ONEDIR_ARCHIVE: "${{ github.workspace }}/build-deb-pkg/artifacts/salt-linux-${{ matrix.arch }}.tar.xz"
|
||||
run: |
|
||||
cd build-deb-pkg
|
||||
echo "${{ inputs.salt-version }}" > salt/_version.txt
|
||||
ln -sf pkg/debian/ .
|
||||
sed -i 's/SALT_RELEASE_VERSION/${{ inputs.salt-version }}/g' debian/changelog
|
||||
debuild -uc -us
|
||||
debuild -e SALT_ONEDIR_ARCHIVE -uc -us
|
||||
|
||||
- name: Upload DEBs
|
||||
uses: actions/upload-artifact@v3
|
||||
|
|
12
.github/workflows/build-rpm-packages.yml
vendored
12
.github/workflows/build-rpm-packages.yml
vendored
|
@ -17,6 +17,7 @@ jobs:
|
|||
- ${{ matrix.arch }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 2
|
||||
matrix:
|
||||
arch:
|
||||
- x86_64
|
||||
|
@ -28,14 +29,21 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Download Onedir Tarball as an Artifact
|
||||
if: inputs.platform != 'windows' && steps.nox-dependencies-cache.outputs.cache-hit != 'true'
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: salt-linux-${{ matrix.arch }}.tar.xz
|
||||
path: artifacts/
|
||||
|
||||
- name: Download System Dependencies
|
||||
run: |
|
||||
yum -y update
|
||||
yum -y install python3 python3-pip openssl git rpmdevtools rpmlint systemd-units
|
||||
yum -y install python3 python3-pip openssl git rpmdevtools rpmlint systemd-units libxcrypt-compat
|
||||
|
||||
- name: Build RPM
|
||||
env:
|
||||
USE_STATIC_REQUIREMENTS: "1"
|
||||
SALT_ONEDIR_ARCHIVE: "${{ github.workspace }}/artifacts/salt-linux-${{ matrix.arch }}.tar.xz"
|
||||
run: |
|
||||
echo "${{ inputs.salt-version }}" > salt/_version.txt
|
||||
sed -i 's/^Version: \(.*\)$/Version: ${{ inputs.salt-version }}/g' pkg/rpm/salt.spec
|
||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -550,6 +550,7 @@ jobs:
|
|||
if: ${{ fromJSON(needs.prepare-ci.outputs.jobs)['self-hosted-runners'] }}
|
||||
needs:
|
||||
- prepare-ci
|
||||
- build-salt-linux
|
||||
uses: ./.github/workflows/build-rpm-packages.yml
|
||||
with:
|
||||
salt-version: "${{ needs.prepare-ci.outputs.salt-version }}"
|
||||
|
@ -559,6 +560,7 @@ jobs:
|
|||
if: ${{ fromJSON(needs.prepare-ci.outputs.jobs)['self-hosted-runners'] }}
|
||||
needs:
|
||||
- prepare-ci
|
||||
- build-salt-linux
|
||||
uses: ./.github/workflows/build-deb-packages.yml
|
||||
with:
|
||||
salt-version: "${{ needs.prepare-ci.outputs.salt-version }}"
|
||||
|
|
|
@ -13,34 +13,31 @@ override_dh_auto_clean:
|
|||
rm -rf debian/salt-syndic
|
||||
rm -rf debian/salt-ssh
|
||||
|
||||
ifeq ("${SALT_ONEDIR_ARCHIVE}", "")
|
||||
override_dh_auto_build:
|
||||
mkdir build
|
||||
test -n "${ONEDIR_DEPS_ARCHIVE}" \
|
||||
&& cd build \
|
||||
&& tar xf ${ONEDIR_DEPS_ARCHIVE} \
|
||||
&& cd .. \
|
||||
|| true
|
||||
test -z "${ONEDIR_DEPS_ARCHIVE}" \
|
||||
&& python3 -m venv --clear --copies build/venv \
|
||||
&& build/venv/bin/python3 -m pip install relenv \
|
||||
&& build/venv/bin/relenv fetch \
|
||||
&& build/venv/bin/relenv toolchain fetch \
|
||||
&& build/venv/bin/relenv create build/salt \
|
||||
&& build/salt/bin/python3 -m pip install "pip>=22.3.1,<23.0" "setuptools>=65.6.3,<66" "wheel" \
|
||||
&& export PY=$$(build/salt/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
|
||||
&& build/salt/bin/python3 -m pip install -r requirements/static/pkg/py$${PY}/linux.txt \
|
||||
|| true
|
||||
|
||||
export USE_STATIC_REQUIREMENTS=1
|
||||
export RELENV_PIP_DIR=1
|
||||
test -n "${SALT_SRC_TARBALL}" \
|
||||
&& build/salt/bin/python3 -m pip install --no-warn-script-location "${SALT_SRC_TARBALL}" \
|
||||
|| build/salt/bin/python3 -m pip install --no-warn-script-location .
|
||||
|
||||
build/salt/bin/python3 -m venv --clear --copies build/tools
|
||||
export PY=$$(build/tools/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
|
||||
&& build/tools/bin/python3 -m pip install -r requirements/static/ci/py$${PY}/tools.txt
|
||||
build/tools/bin/tools pkg pre-archive-cleanup --pkg build/salt
|
||||
mkdir -p build/onedir
|
||||
python3 -m venv --clear --copies build/onedir/venv
|
||||
build/onedir/venv/bin/python3 -m pip install relenv
|
||||
build/onedir/venv/bin/relenv fetch
|
||||
build/onedir/venv/bin/relenv toolchain fetch
|
||||
build/onedir/venv/bin/relenv create build/onedir/salt
|
||||
build/onedir/salt/bin/python3 -m pip install "pip>=22.3.1,<23.0" "setuptools>=65.6.3,<66" "wheel"
|
||||
export PY=$$(build/onedir/salt/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
|
||||
&& build/onedir/salt/bin/python3 -m pip install -r requirements/static/pkg/py$${PY}/linux.txt
|
||||
export USE_STATIC_REQUIREMENTS=1 \
|
||||
&& export RELENV_PIP_DIR=1 \
|
||||
&& build/onedir/salt/bin/python3 -m pip install --no-warn-script-location .
|
||||
build/onedir/salt/bin/python3 -m venv --clear --copies build/onedir/tools
|
||||
export PY=$$(build/onedir/tools/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
|
||||
&& build/onedir/tools/bin/python3 -m pip install -r requirements/static/ci/py$${PY}/tools.txt
|
||||
build/onedir/tools/bin/tools pkg pre-archive-cleanup --pkg build/onedir/salt
|
||||
else
|
||||
override_dh_auto_build:
|
||||
# The relenv onedir is being provided, all setup up until Salt is installed
|
||||
# is expected to be done
|
||||
mkdir -p build/onedir
|
||||
cd build/onedir; tar xvf ${SALT_ONEDIR_ARCHIVE}
|
||||
endif
|
||||
|
||||
# dh_auto_install tries to invoke distutils causing failures.
|
||||
override_dh_auto_install:
|
||||
|
@ -48,5 +45,5 @@ override_dh_auto_install:
|
|||
|
||||
override_dh_install:
|
||||
mkdir -p debian/salt-common/usr/opt/saltstack
|
||||
cp -R build/salt debian/salt-common/usr/opt/saltstack/
|
||||
cp -R build/onedir/salt debian/salt-common/usr/opt/saltstack/
|
||||
dh_install
|
||||
|
|
|
@ -132,33 +132,30 @@ rm -rf $RPM_BUILD_DIR
|
|||
mkdir -p $RPM_BUILD_DIR/build
|
||||
cd $RPM_BUILD_DIR
|
||||
|
||||
test -n "${ONEDIR_DEPS_ARCHIVE}" \
|
||||
&& cd build \
|
||||
&& tar xf ${ONEDIR_DEPS_ARCHIVE} \
|
||||
&& cd .. \
|
||||
|| true
|
||||
test -z "${ONEDIR_DEPS_ARCHIVE}" \
|
||||
&& python3 -m venv --clear --copies build/venv \
|
||||
&& build/venv/bin/python3 -m pip install relenv \
|
||||
&& build/venv/bin/relenv fetch \
|
||||
&& build/venv/bin/relenv toolchain fetch \
|
||||
&& build/venv/bin/relenv create build/salt \
|
||||
&& build/salt/bin/python3 -m pip install "pip>=22.3.1,<23.0" "setuptools>=65.6.3,<66" "wheel" \
|
||||
&& export PY=$(build/salt/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
|
||||
&& build/salt/bin/python3 -m pip install -r %{_salt_src}/requirements/static/pkg/py${PY}/linux.txt \
|
||||
|| true
|
||||
%if "%{getenv:SALT_ONEDIR_ARCHIVE}" == ""
|
||||
python3 -m venv --clear --copies build/venv
|
||||
build/venv/bin/python3 -m pip install relenv
|
||||
build/venv/bin/relenv fetch
|
||||
build/venv/bin/relenv toolchain fetch
|
||||
build/venv/bin/relenv create build/salt
|
||||
build/salt/bin/python3 -m pip install "pip>=22.3.1,<23.0" "setuptools>=65.6.3,<66" "wheel"
|
||||
export PY=$(build/salt/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()')
|
||||
build/salt/bin/python3 -m pip install -r %{_salt_src}/requirements/static/pkg/py${PY}/linux.txt
|
||||
export USE_STATIC_REQUIREMENTS=1
|
||||
export RELENV_PIP_DIR=1
|
||||
build/salt/bin/python3 -m pip install --no-warn-script-location %{_salt_src}
|
||||
|
||||
export USE_STATIC_REQUIREMENTS=1
|
||||
export RELENV_PIP_DIR=1
|
||||
test -n "${SALT_SRC_TARBALL}" \
|
||||
&& build/salt/bin/python3 -m pip install --no-warn-script-location "${SALT_SRC_TARBALL}" \
|
||||
|| build/salt/bin/python3 -m pip install --no-warn-script-location %{_salt_src}
|
||||
|
||||
build/salt/bin/python3 -m venv --clear --copies build/tools
|
||||
export PY=$(build/tools/bin/python3 -c 'import sys; sys.stdout.write("{}.{}".format(*sys.version_info)); sys.stdout.flush()') \
|
||||
&& build/tools/bin/python3 -m pip install -r %{_salt_src}/requirements/static/ci/py${PY}/tools.txt
|
||||
cd %{_salt_src}
|
||||
$RPM_BUILD_DIR/build/tools/bin/tools pkg pre-archive-cleanup --pkg $RPM_BUILD_DIR/build/salt
|
||||
build/salt/bin/python3 -m venv --clear --copies build/tools
|
||||
build/tools/bin/python3 -m pip install -r %{_salt_src}/requirements/static/ci/py${PY}/tools.txt
|
||||
cd %{_salt_src}
|
||||
$RPM_BUILD_DIR/build/tools/bin/tools pkg pre-archive-cleanup --pkg $RPM_BUILD_DIR/build/salt
|
||||
%else
|
||||
# The relenv onedir is being provided, all setup up until Salt is installed
|
||||
# is expected to be done
|
||||
cd build
|
||||
tar xf ${SALT_ONEDIR_ARCHIVE}
|
||||
cd ..
|
||||
%endif
|
||||
|
||||
|
||||
%install
|
||||
|
|
Loading…
Add table
Reference in a new issue