mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
Debian build fixes (also the book) (#2400)
* betterer errors on things * Adding tpm-udev as a dependency of kanidm-unixd * fixing makefile arch error * adding jq to deb build deps * adding kanidm deb to autobuild * making the debian build script more resilient
This commit is contained in:
parent
8dc884f38e
commit
cf87993a1c
2
.github/workflows/debian_package_kanidm.yml
vendored
2
.github/workflows/debian_package_kanidm.yml
vendored
|
@ -47,7 +47,7 @@ jobs:
|
||||||
run: cargo install wasm-pack
|
run: cargo install wasm-pack
|
||||||
- name: Build packages (kanidm-unixd)
|
- name: Build packages (kanidm-unixd)
|
||||||
run: make -f platform/debian/Makefile debs/kanidm-unixd
|
run: make -f platform/debian/Makefile debs/kanidm-unixd
|
||||||
- name: Build packages (kanidm cli)
|
- name: Build packages (kanidm)
|
||||||
run: make -f platform/debian/Makefile debs/kanidm
|
run: make -f platform/debian/Makefile debs/kanidm
|
||||||
|
|
||||||
- name: Upload debs
|
- name: Upload debs
|
||||||
|
|
18
.github/workflows/docker_build_kanidmd.yml
vendored
18
.github/workflows/docker_build_kanidmd.yml
vendored
|
@ -19,6 +19,24 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Docker metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
# list of Docker images to use as base name for tags
|
||||||
|
# images: |
|
||||||
|
# kanidm/kanidmd
|
||||||
|
# ghcr.io/username/app
|
||||||
|
# generate Docker tags based on the following events/attributes
|
||||||
|
tags: |
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
- name: Build kanidmd
|
- name: Build kanidmd
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
7
.github/workflows/kanidm_book.yml
vendored
7
.github/workflows/kanidm_book.yml
vendored
|
@ -85,8 +85,6 @@ jobs:
|
||||||
# yamllint disable-line rule:line-length
|
# yamllint disable-line rule:line-length
|
||||||
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm' }}
|
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Pages
|
|
||||||
uses: actions/configure-pages@v4
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
@ -100,7 +98,7 @@ jobs:
|
||||||
- name: Download individual artifact
|
- name: Download individual artifact
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: individual
|
name: ${{ needs.pre_deploy.outputs.latest}}
|
||||||
path: ./docs/
|
path: ./docs/
|
||||||
env:
|
env:
|
||||||
ACTIONS_RUNNER_DEBUG: true
|
ACTIONS_RUNNER_DEBUG: true
|
||||||
|
@ -124,11 +122,14 @@ jobs:
|
||||||
rm docs/*.tar.gz
|
rm docs/*.tar.gz
|
||||||
env:
|
env:
|
||||||
ACTIONS_RUNNER_DEBUG: true
|
ACTIONS_RUNNER_DEBUG: true
|
||||||
|
- name: Setup Pages
|
||||||
|
uses: actions/configure-pages@v4
|
||||||
- name: Upload pages artifacts
|
- name: Upload pages artifacts
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
# Upload entire repository
|
# Upload entire repository
|
||||||
path: 'docs/'
|
path: 'docs/'
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
uses: actions/deploy-pages@v4
|
uses: actions/deploy-pages@v4
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
ARCH ?= $(dpkg --print-architecture)
|
ARCH ?= $(shell dpkg --print-architecture)
|
||||||
|
|
||||||
|
|
||||||
.DEFAULT: help
|
.DEFAULT: help
|
||||||
|
|
|
@ -8,10 +8,11 @@ if [ -z "${ARCH}" ]; then
|
||||||
ARCH="$(dpkg --print-architecture)"
|
ARCH="$(dpkg --print-architecture)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${ARCH}" -ne "$(dpkg --print-architecture)" ]; then
|
if [ "${ARCH}" != "$(dpkg --print-architecture)" ]; then
|
||||||
echo "${ARCH} -ne $(dpkg --print-architecture), cross-compiling!"
|
echo "${ARCH} != $(dpkg --print-architecture), cross-compiling!"
|
||||||
export PKG_CONFIG_ALLOW_CROSS=1
|
export PKG_CONFIG_ALLOW_CROSS=1
|
||||||
|
else
|
||||||
|
echo "Building for ${ARCH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,12 +30,16 @@ fi
|
||||||
echo "Building ${PACKAGE}"
|
echo "Building ${PACKAGE}"
|
||||||
|
|
||||||
|
|
||||||
if [ -n "${GITHUB_WORKSPACE}" ]; then
|
SOURCE_DIR="$(cargo metadata --format-version 1 | jq -r .workspace_root)"
|
||||||
SOURCE_DIR="${GITHUB_WORKSPACE}"
|
|
||||||
else
|
echo "Source dir ${SOURCE_DIR}"
|
||||||
SOURCE_DIR="${HOME}/kanidm"
|
|
||||||
|
if [ ! -d "${SOURCE_DIR}" ]; then
|
||||||
|
echo "Can't find source dir ${SOURCE_DIR}!"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
BUILD_DIR="$HOME/build"
|
|
||||||
|
BUILD_DIR="$(mktemp -d)"
|
||||||
|
|
||||||
if [ -z "${SKIP_DEPS}" ]; then
|
if [ -z "${SKIP_DEPS}" ]; then
|
||||||
PACKAGING=1 ./scripts/install_ubuntu_dependencies.sh
|
PACKAGING=1 ./scripts/install_ubuntu_dependencies.sh
|
||||||
|
@ -42,14 +47,22 @@ else
|
||||||
echo "SKIP_DEPS configured, skipping install of rust and packages"
|
echo "SKIP_DEPS configured, skipping install of rust and packages"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f "${HOME}/.cargo/env" ]; then
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091
|
||||||
source "$HOME/.cargo/env"
|
source "${HOME}/.cargo/env"
|
||||||
|
else
|
||||||
|
echo "Couldn't find cargo env in ${HOME}/.cargo/env that seems weird?"
|
||||||
|
fi
|
||||||
|
|
||||||
# if we can't find cargo then need to update the path
|
# if we can't find cargo then need to update the path
|
||||||
if [ "$(which cargo | wc -l)" -eq 0 ]; then
|
if [ "$(which cargo | wc -l)" -eq 0 ]; then
|
||||||
if echo "$PATH" | grep -q '.cargo/bin'; then
|
if echo "$PATH" | grep -q '.cargo/bin'; then
|
||||||
echo "Updating path to include local cargo dir"
|
echo "Updating path to include local cargo dir"
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
if [ "$(which cargo | wc -l)" -eq 0 ]; then
|
||||||
|
echo "Still couldn't find cargo, bailing!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -73,14 +86,16 @@ echo "Package Version: ${PACKAGE_VERSION}"
|
||||||
echo "Updating package dir"
|
echo "Updating package dir"
|
||||||
rm -rf "${BUILD_DIR:?}/*"
|
rm -rf "${BUILD_DIR:?}/*"
|
||||||
|
|
||||||
echo "Copying source files to ${BUILD_DIR}"
|
echo "Copying source files from ${SOURCE_DIR} to ${BUILD_DIR}"
|
||||||
rsync -a \
|
rsync -a \
|
||||||
--exclude target \
|
--exclude target \
|
||||||
"${SOURCE_DIR}" \
|
"${SOURCE_DIR}/" \
|
||||||
"${BUILD_DIR}/"
|
"${BUILD_DIR}/"
|
||||||
|
|
||||||
echo "Copying the debian-specific build files"
|
echo "Copying the debian-specific build files"
|
||||||
cd "${BUILD_DIR}/kanidm"
|
cd "${BUILD_DIR}"
|
||||||
|
pwd
|
||||||
|
ls -la
|
||||||
rm -rf debian && mkdir -p debian
|
rm -rf debian && mkdir -p debian
|
||||||
cp -R platform/debian/packaging/* debian/
|
cp -R platform/debian/packaging/* debian/
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@ Rules-Requires-Root: no
|
||||||
|
|
||||||
Package: kanidm-unixd
|
Package: kanidm-unixd
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends:
|
Depends: tpm-udev
|
||||||
Description: Kanidm Unix Tools
|
Description: Kanidm Unix Tools
|
||||||
|
|
|
@ -18,6 +18,7 @@ ${SUDOCMD} apt-get install -y \
|
||||||
rsync \
|
rsync \
|
||||||
git \
|
git \
|
||||||
build-essential \
|
build-essential \
|
||||||
|
jq
|
||||||
|
|
||||||
if [ -z "${PACKAGING}" ]; then
|
if [ -z "${PACKAGING}" ]; then
|
||||||
PACKAGING=0
|
PACKAGING=0
|
||||||
|
|
|
@ -15,7 +15,10 @@ impl DaemonClientBlocking {
|
||||||
|
|
||||||
let stream = UnixStream::connect(path)
|
let stream = UnixStream::connect(path)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("stream setup error -> {:?}", e);
|
error!(
|
||||||
|
"Unix socket stream setup error while connecting to {} -> {:?}",
|
||||||
|
path, e
|
||||||
|
);
|
||||||
e
|
e
|
||||||
})
|
})
|
||||||
.map_err(Box::new)?;
|
.map_err(Box::new)?;
|
||||||
|
@ -38,14 +41,20 @@ impl DaemonClientBlocking {
|
||||||
match self.stream.set_read_timeout(Some(timeout)) {
|
match self.stream.set_read_timeout(Some(timeout)) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("stream setup error -> {:?}", e);
|
error!(
|
||||||
|
"Unix socket stream setup error while setting read timeout -> {:?}",
|
||||||
|
e
|
||||||
|
);
|
||||||
return Err(Box::new(e));
|
return Err(Box::new(e));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
match self.stream.set_write_timeout(Some(timeout)) {
|
match self.stream.set_write_timeout(Some(timeout)) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("stream setup error -> {:?}", e);
|
error!(
|
||||||
|
"Unix socket stream setup error while setting write timeout -> {:?}",
|
||||||
|
e
|
||||||
|
);
|
||||||
return Err(Box::new(e));
|
return Err(Box::new(e));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue