76 lines
2.0 KiB
Groovy
76 lines
2.0 KiB
Groovy
#!groovy
|
|
|
|
def repository = "registry.c.test-chamber-13.lan"
|
|
def repositoryCreds = "harbor-repository-creds"
|
|
|
|
def workspace
|
|
def dockerFile
|
|
def steamSecret = 'steam-login-token'
|
|
def steamToken
|
|
|
|
def label = "kubernetes-${UUID.randomUUID().toString()}"
|
|
def templateName = "pipeline-worker"
|
|
|
|
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"]
|
|
"""
|
|
|
|
withCredentials([string(
|
|
credentialsId: steamSecret,
|
|
variable: "token"
|
|
)]) {
|
|
steamToken = token
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
functions.buildContainer(
|
|
repository: repository,
|
|
imageDest: "${repository}/library/project-zomboid:latest",
|
|
dockerFile: dockerFile,
|
|
repoCreds: repositoryCreds,
|
|
[
|
|
"STEAM_TOKEN=${steamToken}",
|
|
],
|
|
)
|
|
|
|
functions.deletePod(
|
|
kubeAuth: "k8s-game-servers-access",
|
|
kubeURL: "https://k8s.test-chamber-13.lan:8043",
|
|
namespace: "game-servers",
|
|
selector: "app=project-zomboid"
|
|
)
|
|
}
|
|
} |