-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add justfile + containerfile for local build testing (#63)
* feat: add justfile + containerfile for local build testing * fix(just, containerfile): properly get build files * feat(just): clean target
- Loading branch information
1 parent
a008744
commit 6f5e81d
Showing
3 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM registry.fedoraproject.org/fedora:latest AS builder | ||
ARG TARGET_SPEC="${TARGET_SPEC:-staging/devpod/devpod.spec}" | ||
|
||
COPY . /app | ||
|
||
RUN dnf update -y && dnf upgrade -y && dnf install rpkg spectool -y && dnf clean all | ||
|
||
WORKDIR /app | ||
RUN cp -rf $(dirname $TARGET_SPEC)/* /tmp && \ | ||
rpkg --path $(dirname $TARGET_SPEC) spec --outdir /tmp --spec $(basename $TARGET_SPEC) | ||
|
||
WORKDIR /tmp | ||
RUN export SPEC=$(basename $TARGET_SPEC) && \ | ||
dnf -y builddep $SPEC && \ | ||
spectool -ag $SPEC -C /tmp && \ | ||
rpkg local --spec $SPEC --outdir /tmp && \ | ||
find /tmp | ||
|
||
FROM scratch AS artifacts | ||
|
||
COPY --from=builder /tmp/*/*.rpm / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Run renovate locally to test modules | ||
renovate dry-run="lookup" log-level="debug": | ||
#!/usr/bin/env bash | ||
if ! command -v "renovate" &> /dev/null ; then | ||
echo "You need to install renovate first" | ||
echo "It should be available on brew and on npm." | ||
exit 1 | ||
fi | ||
if [ "$GITHUB_COM_TOKEN" == "" ] ; then | ||
echo "Warning: No Github token found, renovate will nag at you for this." | ||
echo "Set it with GITHUB_COM_TOKEN=(your token)" | ||
fi | ||
LOG_LEVEL=${LOG_LEVEL:-debug} renovate --platform=local --dry-run={{dry-run}} | ||
echo "Updates can be found in a section of the logs called \"packageFiles with updates\"" | ||
build package="staging/devpod/devpod.spec": | ||
#!/usr/bin/env bash | ||
PKGNAME={{package}} | ||
PKGNAME="${PKGNAME##*/}" | ||
PKGNAME="${PKGNAME%.*}" | ||
buildah bud -f Containerfile -t localhost/${PKGNAME}:latest --build-arg TARGET_SPEC={{package}} . | ||
extract package="staging/devpod/devpod.spec" extract_rpm="0": | ||
#!/usr/bin/env bash | ||
PKGNAME={{package}} | ||
PKGNAME="${PKGNAME##*/}" | ||
PKGNAME="${PKGNAME%.*}" | ||
rm -rf output | ||
mkdir -p output | ||
podman export $(podman create localhost/${PKGNAME}:latest) | tar xf - -C output | ||
if [ {{extract_rpm}} -ne 1 ] ; then | ||
exit 0 | ||
fi | ||
pushd output | ||
for rpm_file in $(find . -iname "*.rpm"); do | ||
rpm2cpio "$rpm_file" | cpio -idmv | ||
done | ||
popd | ||
clean: | ||
rm -rf output |