This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
build-containers/build-vlmcsd.jenkins
2022-11-18 13:53:27 -06:00

133 lines
4.2 KiB
Groovy

#!groovy
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def workspace
def dockerFile
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
pipeline {
agent {
kubernetes {
yaml functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true,
alpine: true
)
}
}
stages {
stage ('Initalize Jenkins') {
steps {
script {
workspace = pwd()
dockerFile = """
FROM ${repository}/library/alpine:latest
LABEL org.opencontainers.image.authors="The_Spider <spider@smoothnet.org>"
LABEL org.opencontainers.image.title="vlmcsd"
LABEL org.opencontainers.image.description="Docker container for the windows activation server"
LABEL org.opencontainers.image.base.name="docker.io/library/alpine:latest"
ENV LISTEN_IP="0.0.0.0"
ENV LISTEN_PORT="1688"
ENV MAX_CLIENTS="5"
ENV TIMEOUT_INACTIVITY="5"
ENV RENEW_INTERVAL="1w"
ENV RETRY_INTERVAL="1h"
ENV LCID="1033"
ENV BUILD_NO="36446"
RUN apk add --no-cache openssl && \\
addgroup -g 1000 -S vlmcsd && \\
adduser -u 1000 -G vlmcsd -S -D -h /home/vlmcsd vlmcsd
COPY vlmcsd/bin/vlmcsd vlmcsd/etc/vlmcsd.kmd /home/vlmcsd
EXPOSE 1688/tcp
WORKDIR /home/vlmcsd
HEALTHCHECK --interval=1m --timeout=3s --start-period=10s --retries=3 \
CMD ["/bin/sh", "-c", "printf '\\n' | openssl s_client --connect 127.0.0.1:1688 2> /dev/null | grep 'CONNECTED'"]
ENTRYPOINT ["/bin/sh", "-c", "./vlmcsd -L \${LISTEN_IP}:\${LISTEN_PORT} -m \${MAX_CLIENTS} -t \${TIMEOUT_INACTIVITY} -e -N1 -B1 -C \${LCID} -R \${RENEW_INTERVAL} -A \${RETRY_INTERVAL} -H \${BUILD_NO} -v -D -j ./vlmcsd.kmd"]
"""
}
}
}
stage ("Pull VLMCSD Source") {
steps {
script {
dir("vlmcsd") {
checkout ([
$class: "GitSCM",
branches: [
[
name: "refs/heads/master",
],
],
userRemoteConfigs: [
[
url: "ssh://git@gitea.c.test-chamber-13.lan:31822/nhyatt/vlmcsd-source.git",
credentialsId: "Gitea-Read-Only-Token",
],
],
extensions: [
[
$class: "CloneOption",
shallow: true,
],
[
$class: "CheckoutOption",
timeout: 2,
],
],
])
}
}
}
}
stage ("Compile VLMCSD") {
steps {
container ('alpine') {
script {
sh """
apk --no-cache add gcc make musl-dev git
cd "${workspace}/vlmcsd"
make
"""
}
}
}
}
stage ('Build & Push') {
steps {
container ('kaniko') {
script {
declarativeFunctions.buildContainerMultipleDestinations(
dockerFile: dockerFile,
repositoryAccess: [
[
repository: repository,
credentials: repositoryCreds
],
],
destination: [
"${repository}/library/vlmcsd:latest",
]
)
}
}
}
}
}
}