Skip to content
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

Upgrade to v3005 Phosphorus #152

Merged
merged 22 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f0a4e9f
feat: Change Docker base image to ubuntu:jammy-20220531
cdalvaro Jun 22, 2022
0f5fcbf
feat: Upgrade Python to version 3.10
cdalvaro Jun 22, 2022
5ad70b8
feat: Install python3-pygit2 version 1.6.1 from Ubuntu repositories
cdalvaro Jun 22, 2022
753b021
feat: Remove install_libssh2 function
cdalvaro Jun 22, 2022
4f1e059
feat: Remove install_libgit2 function
cdalvaro Jun 22, 2022
6f1891c
feat: Remove build_and_install function
cdalvaro Jun 22, 2022
b71f27c
Upgrade salt-master to 3005rc1 Silicon
cdalvaro Jul 19, 2022
157cc86
feat(tests): Update basic tests
cdalvaro Jul 19, 2022
f3d7d8a
feat: Do not install timelib manually
cdalvaro Jul 19, 2022
524c2bd
feat: Use `python3` default distro version
cdalvaro Jul 21, 2022
53bcf55
Merge remote-tracking branch 'origin/main' into feature/upgrade_ubunt…
cdalvaro Jul 21, 2022
f2c07f0
ci(tests): Use `python3` version `3.10`
cdalvaro Jul 21, 2022
6d0e275
feat: Remove USERMAP_UID and USERMAP_GID env variables support
cdalvaro Jul 22, 2022
a6b237d
Upgrade salt-master to 3005rc2 Phosphorus
cdalvaro Aug 2, 2022
6f38669
feat: Change Docker base image to ubuntu:jammy-20220801
cdalvaro Aug 2, 2022
b8ca697
doc: Update README.md
cdalvaro Aug 6, 2022
90553e0
feat: Update image labels to comply with opencontainers.org rules
cdalvaro Aug 9, 2022
d08fe13
feat: Update salt-bootstrap script to version 2022.05.19
cdalvaro Aug 10, 2022
c1b6d92
feat: Update salt-bootstrap script to version 2022.08.12
cdalvaro Aug 12, 2022
d0074f3
feat: Update opencontainers.org image labels
cdalvaro Aug 12, 2022
27b6694
feat: Update salt-bootstrap script to version 2022.08.13
cdalvaro Aug 14, 2022
6f584c9
Upgrade salt-master to 3005 Phosphorus
cdalvaro Aug 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The full log with the outputted error.
**Version report (please complete the following information):**
- Host OS: [e.g. `uname -a`]
- Docker: [e.g. `docker --version`]
- Image tag: [e.g. `3004.2`]
- Image tag: [e.g. `3005`]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'

- name: Execute basic tests
run: tests/basic/test.sh
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Changelog

This file only reflects the changes that are made in this image.
Please refer to the [Salt 3004.2 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3004.2.html)
Please refer to the [Salt 3005 Release Notes](https://docs.saltstack.com/en/latest/topics/releases/3005.html)
for the list of changes in SaltStack.

**3005**

- Upgrade `salt-master` to `3005` *Phosphorus*
- Upgrade `salt-bootstrap` to version `2022.08.13`
- Change Docker base image to `ubuntu:jammy-20220801`
- Use `python3` default distro version
- Install `python3-pygit2` version `1.6.1` from Ubuntu repositories
- Remove `USERMAP_UID` and `USERMAP_GID` env variables in favor of `PUID` and `PGID`, respectively.
- CI(tests): Use `python3` version `3.10`

**3004.2**

- Upgrade `salt-master` to `3004.2` *Silicon*
Expand Down
33 changes: 17 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM ubuntu:hirsute-20220113
FROM ubuntu:jammy-20220801

ARG BUILD_DATE
ARG VCS_REF

# https://github.com/saltstack/salt/releases
# NOTE: Review org.label-schema.version label if necessary
ENV SALT_VERSION="3004.2" \
PYTHON_VERSION="3.9"
ENV SALT_VERSION="3005"
ENV IMAGE_VERSION="${SALT_VERSION}"

ENV SALT_DOCKER_DIR="/etc/docker-salt" \
SALT_ROOT_DIR="/etc/salt" \
Expand All @@ -32,7 +31,7 @@ WORKDIR ${SALT_BUILD_DIR}
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --yes --quiet --no-install-recommends \
sudo ca-certificates openssl apt-transport-https wget locales openssh-client \
python${PYTHON_VERSION} python3-dev libpython3-dev \
python3 python3-dev libpython3-dev \
python3-pip python3-setuptools python3-wheel \
supervisor logrotate git gettext-base tzdata inotify-tools psmisc \
&& DEBIAN_FRONTEND=noninteractive update-locale LANG=C.UTF-8 LC_MESSAGES=POSIX \
Expand Down Expand Up @@ -63,17 +62,19 @@ RUN mkdir -p "${SALT_BASE_DIR}" "${SALT_FORMULAS_DIR}" "${SALT_KEYS_DIR}" "${SAL
VOLUME [ "${SALT_BASE_DIR}", "${SALT_FORMULAS_DIR}", "${SALT_KEYS_DIR}", "${SALT_CONFS_DIR}", "${SALT_LOGS_DIR}" ]

LABEL \
maintainer="[email protected]" \
org.label-schema.vendor=cdalvaro \
org.label-schema.name="SaltStack Master" \
org.label-schema.version="${SALT_VERSION}_6" \
org.label-schema.description="Dockerized SaltStack Master" \
org.label-schema.url="https://github.com/cdalvaro/docker-salt-master" \
org.label-schema.vcs-url="https://github.com/cdalvaro/docker-salt-master.git" \
org.label-schema.vcs-ref=${VCS_REF} \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.docker.schema-version="1.0" \
com.cdalvaro.docker-salt-master.license=MIT
org.opencontainers.image.title="Dockerized Salt Master" \
org.opencontainers.image.description="salt-master ${SALT_VERSION} containerized" \
org.opencontainers.image.documentation="https://github.com/cdalvaro/docker-salt-master/blob/${IMAGE_VERSION}/README.md" \
org.opencontainers.image.url="https://github.com/cdalvaro/docker-salt-master" \
org.opencontainers.image.source="https://github.com/cdalvaro/docker-salt-master.git" \
org.opencontainers.image.authors="Carlos Álvaro <[email protected]>" \
org.opencontainers.image.vendor=cdalvaro \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.version="${IMAGE_VERSION}" \
org.opencontainers.image.revision=${VCS_REF} \
org.opencontainers.image.base.digest="sha256:42ba2dfce475de1113d55602d40af18415897167d47c2045ec7b6d9746ff148f" \
org.opencontainers.image.base.name="ubuntu:jammy-20220801" \
org.opencontainers.image.licenses=MIT

WORKDIR ${SALT_HOME}
ENTRYPOINT [ "/sbin/entrypoint.sh" ]
Expand Down
254 changes: 163 additions & 91 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3004.2
3005
88 changes: 0 additions & 88 deletions assets/build/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,91 +139,3 @@ function extract()
log_info "Unpacking file: ${FILE}"
tar xzf "${FILE}" --strip-components 1
}

#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: build_and_install
# DESCRIPTION: Build and install the given package from the current directory using cmake.
#----------------------------------------------------------------------------------------------------------------------
function build_and_install()
{
local PACKAGE_NAME="${1}"; shift
local CMAKE_ARGS=(
-Wno-dev
-DCMAKE_BUILD_TYPE=Release
)

# shellcheck disable=SC2206
CMAKE_ARGS+=( $@ )

log_info "Building and installing ${PACKAGE_NAME} ..."
log_debug "CMAKE_ARGS: ${CMAKE_ARGS[@]}"
cmake ${CMAKE_ARGS[@]} .
cmake --build . --target install --config Release
}

#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: install_libssh2
# DESCRIPTION: Install libssh2 library.
#----------------------------------------------------------------------------------------------------------------------
function install_libssh2()
{
local LIBSSH2_VERSION=1.10.0
local LIBSSH2_URL="https://github.com/libssh2/libssh2/releases/download/libssh2-${LIBSSH2_VERSION}/libssh2-${LIBSSH2_VERSION}.tar.gz"
local FILE_NAME="libssh2-${LIBSSH2_VERSION}.tar.gz"
local SHA256_SUM='2d64e90f3ded394b91d3a2e774ca203a4179f69aebee03003e5a6fa621e41d51'

local CURRENT_DIR="$(pwd)"
local WORK_DIR="$(mktemp -d)" && cd "${WORK_DIR}"

download "${LIBSSH2_URL}" "${FILE_NAME}"
check_sha256 "${FILE_NAME}" "${SHA256_SUM}"
extract "${FILE_NAME}"

_OPTS=(
-DLINT=OFF
-DBUILD_SHARED_LIBS=ON
-DCRYPTO_BACKEND=OpenSSL
-DENABLE_ZLIB_COMPRESSION=ON
-DENABLE_DEBUG_LOGGING=OFF
-DCLEAR_MEMORY=ON
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTING=OFF
)

build_and_install "libssh2 v${LIBSSH2_VERSION}" ${_OPTS[@]}

cd "${CURRENT_DIR}"
rm -rf "${WORK_DIR}"
}

#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: install_libgit2
# DESCRIPTION: Install libgit2 library.
#----------------------------------------------------------------------------------------------------------------------
function install_libgit2()
{
local LIBGIT2_VERSION=1.4.2
local LIBGIT2_URL="https://github.com/libgit2/libgit2/archive/refs/tags/v${LIBGIT2_VERSION}.tar.gz"
local FILE_NAME="libgit2-${LIBGIT2_VERSION}.tar.gz"
local SHA256_SUM='901c2b4492976b86477569502a41c31b274b69adc177149c02099ea88404ef19'

local CURRENT_DIR="$(pwd)"
local WORK_DIR="$(mktemp -d)" && cd "${WORK_DIR}"

download "${LIBGIT2_URL}" "${FILE_NAME}"
check_sha256 "${FILE_NAME}" "${SHA256_SUM}"
extract "${FILE_NAME}"

_OPTS=(
-DBUILD_SHARED_LIBS=ON
-DUSE_SSH=ON
-DUSE_THREADS=ON
-DBUILD_EXAMPLES=OFF
-DBUILD_TESTS=OFF
)

build_and_install "libgit2 v${LIBGIT2_VERSION}" ${_OPTS[@]}

cd "${CURRENT_DIR}"
rm -rf "${WORK_DIR}"
}
22 changes: 7 additions & 15 deletions assets/build/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ source "${FUNCTIONS_FILE}"

log_info "Installing required packages and build dependencies ..."
REQUIRED_PACKAGES=(
libssl1.1 zlib1g libffi7 libpcre3 libgssapi3-heimdal
libssl3 zlib1g libffi7 libpcre3 libgssapi3-heimdal
)

BUILD_DEPENDENCIES=(
make gcc g++ cmake pkg-config libssl-dev zlib1g-dev libffi-dev
libpcre3-dev heimdal-dev
make gcc g++
)

apt-get update
Expand All @@ -35,20 +34,14 @@ log_info "Installing python3 packages ..."
install_pkgs --quiet \
python3-mako python3-pycryptodome python3-cherrypy3 \
python3-git python3-requests python3-redis python3-gnupg \
python3-mysqldb python3-dateutil python3-libnacl python3-openssl

pip3 install timelib==0.2.5

# Install pygit2 package
install_libssh2
install_libgit2
pip3 install cached-property cffi==1.14.6 pygit2==1.9.1
python3-mysqldb python3-dateutil python3-libnacl python3-openssl \
python3-pygit2

# Downloading bootstrap-salt.sh script
BOOTSTRAP_VERSION='2022.03.15'
BOOTSTRAP_VERSION='2022.08.13'
BOOTSTRAP_URL="https://raw.githubusercontent.com/saltstack/salt-bootstrap/v${BOOTSTRAP_VERSION}/bootstrap-salt.sh"
BOOTSTRAP_FILE='bootstrap-salt.sh'
BOOTSTRAP_SHA256='ed66dc9e71aed7602b9ae548f8535131831026f934f19f868fdefbe6a3ab9bf9'
BOOTSTRAP_SHA256='8363e4dc2410c6d540fabab972ffc612b04bf4b5239e2ffb3e366266d9b63b70'

download "${BOOTSTRAP_URL}" "${BOOTSTRAP_FILE}"
check_sha256 "${BOOTSTRAP_FILE}" "${BOOTSTRAP_SHA256}"
Expand All @@ -61,8 +54,7 @@ check_sha256 "${BOOTSTRAP_FILE}" "${BOOTSTRAP_SHA256}"
## -d: Disables checking if Salt services are enabled to start on system boot
## -P: Allow pip based installations
## -p: Extra-package to install
## -x: Changes the python version used to install a git version of salt
SALT_BOOTSTRAP_OPTS=( -M -N -X -d -P -p salt-api -p salt-call -x "python${PYTHON_VERSION}" )
SALT_BOOTSTRAP_OPTS=( -M -N -X -d -P -p salt-api -p salt-call )

## -I: allow insecure connections while downloading any files
is_arm32 && SALT_BOOTSTRAP_OPTS+=( -I )
Expand Down
3 changes: 3 additions & 0 deletions assets/runtime/env-defaults.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

PUID=${PUID:-1000}
PGID=${PGID:-1000}

DEBUG=${DEBUG:-False}
TIMEZONE=${TIMEZONE:-${TZ:-UTC}}

Expand Down
41 changes: 0 additions & 41 deletions assets/runtime/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,53 +57,12 @@ function log_error()
(>&2 echo "[ERROR] - $*")
}

#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __check_puid_pgid_env
# DESCRIPTION: Check if the PUID and PGID environment variables are set correctly.
#----------------------------------------------------------------------------------------------------------------------
function __check_puid_pgid_env
{
if [[ "${SALT_VERSION}" -ge "3005" ]]; then
log_error "The USERMAP_UID and USERMAP_GID environment variables are not supported in Salt >= 3005"
exit 1
fi

if [[ -n "${USERMAP_UID}" ]]; then
log_warn "The USERMAP_UID environment variable is deprecated. Please use PUID instead."
log_warn "Support for USERMAP_UID will be removed in Salt 3005 release."
if [[ -z "${PUID}" ]]; then
log_warn "Setting PUID to USERMAP_UID (${USERMAP_UID})"
export PUID="${USERMAP_UID}"
else
log_error "The PUID and USERMAP_UID environment variables are set. PUID will be used."
fi
unset USERMAP_UID
fi

if [[ -n "${USERMAP_GID}" ]]; then
log_warn "The USERMAP_GID environment variable is deprecated. Please use PGID instead."
log_warn "Support for USERMAP_GID will be removed in Salt 3005 release."
if [[ -z "${PGID}" ]]; then
log_info "Setting PGID to USERMAP_GID (${USERMAP_GID})"
export PGID="${USERMAP_GID}"
else
log_error "The PGID and USERMAP_GID environment variables are set. PGID will be used."
fi
unset USERMAP_GID
fi
}

#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: map_uidgid
# DESCRIPTION: Map salt user with host user.
#----------------------------------------------------------------------------------------------------------------------
function map_uidgid()
{
__check_puid_pgid_env
# Move this into env-defaults.sh
[ -z "${PUID}" ] && export PUID=1000
[ -z "${PGID}" ] && export PGID=1000

ORIG_PUID=$(id -u "${SALT_USER}")
ORIG_PGID=$(id -g "${SALT_USER}")
PGID=${PGID:-${PUID:-$ORIG_PGID}}
Expand Down
Binary file added social/SaltProject_verticallogo_teal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions social/jb_beam.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions tests/basic/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ start_container_and_wait || error "container started"
ok "container started"

# Check salt version
echo "==> Checking salt version ..."
docker-exec salt --versions
[[ "$(docker-exec salt --version)" == "salt $(cat VERSION)" ]] || error "salt version"
ok "salt version"
echo "==> Checking salt-master version ..."
docker-exec salt-master --versions
[[ "$(docker-exec salt-master --version)" == "salt-master $(cat VERSION)" ]] || error "salt-master version"
ok "salt-master version"

# Test image calling healthcheck
echo "==> Executing healthcheck ..."
Expand Down