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-projectzomboid.jenkins

66 lines
1.7 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"
def steamToken = "steam-token"
pipeline {
agent {
kubernetes {
yaml functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true
)
}
}
stages {
stage ('Initalize Jenkins') {
steps {
script {
workspace = pwd()
def dockerfile = """
FROM ${repository}/dockerhub/cm2network/steamcmd:latest
LABEL org.opencontainers.image.authors="The_Spider <spider@smoothnet.org>"
LABEL org.opencontainers.image.title="projectzomboid"
ARG STEAM_TOKEN
EXPOSE 16261/udp
EXPOSE 27015/udp
RUN /home/steam/steamcmd/steamcmd.sh +quit && \\
/home/steam/steamcmd/steamcmd.sh +force_install_dir /home/steam/ProjectZomboid +sv_setsteamaccount "\${STEAM_TOKEN}" +app_update 380870 validate +quit
WORKDIR /home/steam/ProjectZomboid
ENTRYPOINT ["/bin/bash", "-c", "/home/steam/ProjectZomboid/start-server.sh"]
"""
}
}
}
functions.buildContainer(
repository: repository,
imageDest: "${repository}/library/project-zomboid:latest",
dockerFile: dockerFile,
repoCreds: repositoryCreds,
)
functions.deletePod(
kubeAuth: "k8s-game-servers-access",
kubeURL: "https://k8s.test-chamber-13.lan:8043",
namespace: "game-servers",
selector: "app=project-zomboid"
)
}
}