mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Install salt into the onedir using tools
This commit is contained in:
parent
a147939f6a
commit
36ca1926f6
2 changed files with 59 additions and 22 deletions
23
.github/actions/build-onedir-salt/action.yml
vendored
23
.github/actions/build-onedir-salt/action.yml
vendored
|
@ -53,30 +53,9 @@ runs:
|
|||
name: salt-${{ inputs.salt-version }}.tar.gz
|
||||
|
||||
- name: Install Salt Into Onedir
|
||||
if: ${{ inputs.platform != 'windows' }}
|
||||
env:
|
||||
USE_STATIC_REQUIREMENTS: "1"
|
||||
RELENV_PIP_DIR: "1"
|
||||
shell: bash
|
||||
run: |
|
||||
artifacts/${{ inputs.package-name }}/bin/python3 -m pip install salt-${{ inputs.salt-version }}.tar.gz
|
||||
if [ ${{ inputs.platform }} == "darwin" ]; then
|
||||
pkg/macos/prep_salt.sh --build-dir ./artifacts/${{ inputs.package-name }}
|
||||
rm -rf ./artifacts/${{ inputs.package-name }}/opt
|
||||
rm -rf ./artifacts/${{ inputs.package-name }}/etc
|
||||
rm -rf ./artifacts/${{ inputs.package-name }}/Library
|
||||
fi
|
||||
|
||||
- name: Install Salt Into Onedir (Windows)
|
||||
if: ${{ inputs.platform == 'windows' }}
|
||||
env:
|
||||
USE_STATIC_REQUIREMENTS: "1"
|
||||
shell: powershell
|
||||
run: |
|
||||
# install salt
|
||||
pkg\windows\install_salt.cmd -BuildDir ".\artifacts\${{ inputs.package-name }}" -CICD -SourceTarball salt-${{ inputs.salt-version }}.tar.gz
|
||||
# prep salt
|
||||
pkg\windows\prep_salt.cmd -BuildDir ".\artifacts\${{ inputs.package-name }}" -CICD
|
||||
tools pkg build salt-onedir salt-${{ inputs.salt-version }}.tar.gz --platform ${{ inputs.platform }} --package-name artifacts/${{ inputs.package-name }}
|
||||
|
||||
- name: Cleanup Salt Onedir Directory
|
||||
shell: bash
|
||||
|
|
|
@ -286,6 +286,64 @@ def onedir_dependencies(
|
|||
ctx.run(str(pip_bin), "install", "-r", str(requirements_file), *no_binary)
|
||||
|
||||
|
||||
@build.command(
|
||||
name="salt-onedir",
|
||||
arguments={
|
||||
"salt_archive": {
|
||||
"help": "The name of the source tarball containing salt, stored under the repo root",
|
||||
},
|
||||
"platform": {
|
||||
"help": "The platform that installed is being installed on",
|
||||
"required": True,
|
||||
},
|
||||
"package_name": {
|
||||
"help": "The name of the relenv environment to install salt into, stored under artifacts/",
|
||||
"required": True,
|
||||
},
|
||||
},
|
||||
)
|
||||
def salt_onedir(
|
||||
ctx: Context,
|
||||
salt_archive: pathlib.Path,
|
||||
platform: str = None,
|
||||
package_name: str = None,
|
||||
):
|
||||
"""
|
||||
Install salt into a relenv onedir environment.
|
||||
"""
|
||||
if TYPE_CHECKING:
|
||||
assert platform is not None
|
||||
assert package_name is not None
|
||||
|
||||
onedir_env = pathlib.Path("artifacts", package_name)
|
||||
_check_pkg_build_files_exist(ctx, onedir_env=onedir_env, salt_archive=salt_archive)
|
||||
|
||||
if platform == "windows":
|
||||
ctx.run(
|
||||
"powershell.exe",
|
||||
r"pkg\windows\install_salt.cmd",
|
||||
"-BuildDir",
|
||||
str(onedir_env),
|
||||
"-CICD",
|
||||
"-SourceTarball",
|
||||
str(salt_archive),
|
||||
)
|
||||
ctx.run(
|
||||
"powershell.exe",
|
||||
r"pkg\windows\prep_salt.cmd",
|
||||
"-BuildDir",
|
||||
str(onedir_env),
|
||||
"-CICD",
|
||||
)
|
||||
else:
|
||||
pip_bin = onedir_env / "bin" / "pip3"
|
||||
ctx.run(str(pip_bin), "install", str(salt_archive))
|
||||
if platform == "darwin":
|
||||
shutil.rmtree(onedir_env / "opt")
|
||||
shutil.rmtree(onedir_env / "etc")
|
||||
shutil.rmtree(onedir_env / "Library")
|
||||
|
||||
|
||||
def _check_pkg_build_files_exist(ctx: Context, **kwargs):
|
||||
for name, path in kwargs.items():
|
||||
if not path.exists():
|
||||
|
|
Loading…
Add table
Reference in a new issue