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:
James Hodgkinson 2024-01-16 11:30:52 +10:00 committed by GitHub
parent 8dc884f38e
commit cf87993a1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 66 additions and 22 deletions

View file

@ -47,7 +47,7 @@ jobs:
run: cargo install wasm-pack
- name: Build packages (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
- name: Upload debs

View file

@ -19,6 +19,24 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
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
uses: docker/build-push-action@v5
with:

View file

@ -85,8 +85,6 @@ jobs:
# yamllint disable-line rule:line-length
if: ${{ github.ref == 'refs/heads/master' && github.repository == 'kanidm/kanidm' }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
@ -100,7 +98,7 @@ jobs:
- name: Download individual artifact
uses: actions/download-artifact@v4
with:
name: individual
name: ${{ needs.pre_deploy.outputs.latest}}
path: ./docs/
env:
ACTIONS_RUNNER_DEBUG: true
@ -124,11 +122,14 @@ jobs:
rm docs/*.tar.gz
env:
ACTIONS_RUNNER_DEBUG: true
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload pages artifacts
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View file

@ -1,4 +1,4 @@
ARCH ?= $(dpkg --print-architecture)
ARCH ?= $(shell dpkg --print-architecture)
.DEFAULT: help

View file

@ -8,10 +8,11 @@ if [ -z "${ARCH}" ]; then
ARCH="$(dpkg --print-architecture)"
fi
if [ "${ARCH}" -ne "$(dpkg --print-architecture)" ]; then
echo "${ARCH} -ne $(dpkg --print-architecture), cross-compiling!"
if [ "${ARCH}" != "$(dpkg --print-architecture)" ]; then
echo "${ARCH} != $(dpkg --print-architecture), cross-compiling!"
export PKG_CONFIG_ALLOW_CROSS=1
else
echo "Building for ${ARCH}"
fi
@ -29,12 +30,16 @@ fi
echo "Building ${PACKAGE}"
if [ -n "${GITHUB_WORKSPACE}" ]; then
SOURCE_DIR="${GITHUB_WORKSPACE}"
else
SOURCE_DIR="${HOME}/kanidm"
SOURCE_DIR="$(cargo metadata --format-version 1 | jq -r .workspace_root)"
echo "Source dir ${SOURCE_DIR}"
if [ ! -d "${SOURCE_DIR}" ]; then
echo "Can't find source dir ${SOURCE_DIR}!"
exit 1
fi
BUILD_DIR="$HOME/build"
BUILD_DIR="$(mktemp -d)"
if [ -z "${SKIP_DEPS}" ]; then
PACKAGING=1 ./scripts/install_ubuntu_dependencies.sh
@ -42,14 +47,22 @@ else
echo "SKIP_DEPS configured, skipping install of rust and packages"
fi
#shellcheck disable=SC1091
source "$HOME/.cargo/env"
if [ -f "${HOME}/.cargo/env" ]; then
# shellcheck disable=SC1091
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 [ "$(which cargo | wc -l)" -eq 0 ]; then
if echo "$PATH" | grep -q '.cargo/bin'; then
echo "Updating path to include local cargo dir"
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
@ -73,14 +86,16 @@ echo "Package Version: ${PACKAGE_VERSION}"
echo "Updating package dir"
rm -rf "${BUILD_DIR:?}/*"
echo "Copying source files to ${BUILD_DIR}"
echo "Copying source files from ${SOURCE_DIR} to ${BUILD_DIR}"
rsync -a \
--exclude target \
"${SOURCE_DIR}" \
"${SOURCE_DIR}/" \
"${BUILD_DIR}/"
echo "Copying the debian-specific build files"
cd "${BUILD_DIR}/kanidm"
cd "${BUILD_DIR}"
pwd
ls -la
rm -rf debian && mkdir -p debian
cp -R platform/debian/packaging/* debian/

View file

@ -10,5 +10,5 @@ Rules-Requires-Root: no
Package: kanidm-unixd
Architecture: any
Depends:
Depends: tpm-udev
Description: Kanidm Unix Tools

View file

@ -18,6 +18,7 @@ ${SUDOCMD} apt-get install -y \
rsync \
git \
build-essential \
jq
if [ -z "${PACKAGING}" ]; then
PACKAGING=0

View file

@ -15,7 +15,10 @@ impl DaemonClientBlocking {
let stream = UnixStream::connect(path)
.map_err(|e| {
error!("stream setup error -> {:?}", e);
error!(
"Unix socket stream setup error while connecting to {} -> {:?}",
path, e
);
e
})
.map_err(Box::new)?;
@ -38,14 +41,20 @@ impl DaemonClientBlocking {
match self.stream.set_read_timeout(Some(timeout)) {
Ok(()) => {}
Err(e) => {
error!("stream setup error -> {:?}", e);
error!(
"Unix socket stream setup error while setting read timeout -> {:?}",
e
);
return Err(Box::new(e));
}
};
match self.stream.set_write_timeout(Some(timeout)) {
Ok(()) => {}
Err(e) => {
error!("stream setup error -> {:?}", e);
error!(
"Unix socket stream setup error while setting write timeout -> {:?}",
e
);
return Err(Box::new(e));
}
};