Compare commits

..

No commits in common. "e5403dbc66c26025f0a4a872541ad48ed49c5e8c" and "6d0bfeedaf08c2747944bb7c065e37c14ca5d78a" have entirely different histories.

8 changed files with 7 additions and 156 deletions

View File

@ -1,4 +0,0 @@
*
!src
!Cargo.toml
!Cargo.lock

View File

@ -1,25 +0,0 @@
FROM registry.fedoraproject.org/fedora-minimal:39 AS build
RUN --mount=type=cache,target=/var/cache \
microdnf install -y \
--setopt install_weak_deps=0 \
cargo\
&& :
COPY . /src
WORKDIR /src
RUN cargo build --release --locked
FROM registry.fedoraproject.org/fedora-minimal:39
COPY --from=build /src/target/release/tmpl /usr/local/bin
ENTRYPOINT ["/usr/local/bin/tmpl"]
LABEL name='tmpl' \
vendor='Dustin C. Hatch' \
license='MIT OR APACHE-2.0' \
version='0.1.0'

70
ci/Jenkinsfile vendored
View File

@ -1,70 +0,0 @@
pipeline {
agent none
stages {
stage('Build') {
matrix {
axes {
axis {
name 'ARCH'
values 'amd64', 'arm64'
}
}
stages {
stage('Build') {
agent {
kubernetes {
yamlFile 'ci/podTemplate.yaml'
yamlMergeStrategy merge()
defaultContainer 'buildah'
nodeSelector "kubernetes.io/arch=${ARCH}"
}
}
stages {
stage("Build") {
steps {
sh '. ci/build.sh'
stash name: env.ARCH, includes: "*.oci.tar"
}
}
}
}
}
}
}
stage('Publish') {
agent {
kubernetes {
yamlFile 'ci/podTemplate.yaml'
yamlMergeStrategy merge()
defaultContainer 'buildah'
}
}
environment {
REGISTRY_AUTH_FILE = "${env.WORKSPACE_TMP}/auth.json"
}
steps {
unstash 'amd64'
unstash 'arm64'
withCredentials([usernamePassword(
credentialsId: 'jenkins-packages',
usernameVariable: 'BUILDAH_USERNAME',
passwordVariable: 'BUILDAH_PASSWORD',
)]) {
sh """
buildah login \
--username \${BUILDAH_USERNAME} \
--password \${BUILDAH_PASSWORD} \
git.pyrocufflink.net
"""
}
sh '. ci/publish.sh'
}
}
}
}

View File

@ -1,6 +0,0 @@
. ci/common.sh
buildah build -t "${IMAGE_NAME}:${TAG}" .
buildah push \
"${IMAGE_NAME}:${TAG}" \
oci-archive:"${PWD}/${NAME}-${ARCH}.oci.tar:${IMAGE_NAME}:${TAG}"

View File

@ -1,13 +0,0 @@
escape_name() {
echo "$1" \
| tr A-Z a-z \
| sed -e 's/[^a-zA-Z0-9._-]/-/g' -e 's/^[.-]/_/'
}
REGISTRY_URL=git.pyrocufflink.net
NAMESPACE=containerimages
NAME="${JOB_NAME#*/}"
NAME=$(escape_name "${NAME%/*}")
TAG=$(escape_name "${BRANCH_NAME}")
IMAGE_NAME="${REGISTRY_URL}/${NAMESPACE}/${NAME}"

View File

@ -1,19 +0,0 @@
spec:
containers:
- name: buildah
image: quay.io/containers/buildah:v1
command:
- cat
stdin: true
tty: true
securityContext:
capabilities:
add:
- SYS_ADMIN
- MKNOD
- SYS_CHROOT
- SETFCAP
resources:
limits:
github.com/fuse: 1
hostUsers: false

View File

@ -1,15 +0,0 @@
. ci/common.sh
buildah manifest create "${IMAGE_NAME}:${TAG}"
for arch in amd64 arm64; do
buildah manifest add "${IMAGE_NAME}:${TAG}" \
oci-archive:"${PWD}/${NAME}-${arch}.oci.tar:${IMAGE_NAME}:${TAG}"
done
buildah manifest push --all "${IMAGE_NAME}:${TAG}" \
"docker://${IMAGE_NAME}:${TAG}-${BUILD_NUMBER}"
buildah manifest push "${IMAGE_NAME}:${TAG}" "docker://${IMAGE_NAME}:${TAG}"
if [ ${BRANCH_NAME} = master ]; then
buildah manifest push "${IMAGE_NAME}:${TAG}" \
"docker://${IMAGE_NAME}:latest"
fi

View File

@ -303,11 +303,14 @@ fn checksum(path: impl AsRef<Path>) -> std::io::Result<Vec<u8>> {
let mut blake = Blake2b512::new();
loop {
let mut buf = vec![0u8; 16384];
let sz = f.read(&mut buf)?;
if sz == 0 {
break;
match f.read_exact(&mut buf) {
Ok(_) => blake.update(buf),
Err(e) if e.kind() == std::io::ErrorKind::UnexpectedEof => {
blake.update(buf);
break;
}
Err(e) => return Err(e),
}
blake.update(&buf[..sz]);
}
Ok(blake.finalize().to_vec())
}