Compare commits
2 Commits
1c33dfa4a4
...
d84603a6ac
Author | SHA1 | Date |
---|---|---|
|
d84603a6ac | |
|
d25d876df5 |
|
@ -1,23 +1,23 @@
|
||||||
FROM registry.fedoraproject.org/fedora-minimal:39 AS build
|
FROM docker.io/library/rust:1.73-alpine AS build
|
||||||
|
|
||||||
RUN --mount=type=cache,target=/var/cache \
|
RUN --mount=type=cache,target=/var/cache \
|
||||||
microdnf install -y \
|
apk add \
|
||||||
--setopt install_weak_deps=0 \
|
musl-dev \
|
||||||
cargo\
|
|
||||||
&& :
|
&& :
|
||||||
|
|
||||||
COPY . /src
|
COPY . /src
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
RUN cargo build --release --locked
|
RUN cargo build --release --locked \
|
||||||
|
&& strip target/release/tmpl
|
||||||
|
|
||||||
|
|
||||||
FROM registry.fedoraproject.org/fedora-minimal:39
|
FROM scratch
|
||||||
|
|
||||||
COPY --from=build /src/target/release/tmpl /usr/local/bin
|
COPY --from=build /src/target/release/tmpl /tmpl
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/local/bin/tmpl"]
|
ENTRYPOINT ["/tmpl"]
|
||||||
|
|
||||||
LABEL name='tmpl' \
|
LABEL name='tmpl' \
|
||||||
vendor='Dustin C. Hatch' \
|
vendor='Dustin C. Hatch' \
|
||||||
|
|
|
@ -1,70 +1,6 @@
|
||||||
pipeline {
|
@Library('containerimages')_
|
||||||
agent none
|
|
||||||
|
|
||||||
stages {
|
buildContainerImage2(
|
||||||
stage('Build') {
|
archlist: ['amd64', 'arm64'],
|
||||||
matrix {
|
pi: false,
|
||||||
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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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}"
|
|
13
ci/common.sh
13
ci/common.sh
|
@ -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}"
|
|
|
@ -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
|
|
|
@ -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
|
|
Loading…
Reference in New Issue