moves un-used files to deprecated folder

This commit is contained in:
2022-03-30 06:57:27 -05:00
parent b620de0f11
commit d2d5c5d5ba
6 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
def nodeLabel = "${UUID.randomUUID().toString()}"
def repository = "registry.c.test-chamber-13.lan"
def kanikoImage = "${repository}/library/kaniko:latest"
def repositoryCreds = "harbor-repository-creds"
podTemplate(
name: "pipelineContainer",
label: nodeLabel,
yaml: """---
apiVersion: v1
kind: Pod
metadata:
name: kaniko
spec:
containers:
- name: kaniko
image: ${kanikoImage}
imagePullPolicy: Always
tty: true
command:
- /busybox/cat
""") {
node (nodeLabel) {
stage ("Prepare Kaniko") {
container ("kaniko") {
withCredentials([usernameColonPassword(
credentialsId: repositoryCreds,
variable: "dCreds",
)]) {
def dockerJSON = """{
"auths": {
"${repository}": {
"auth": "${dcreds.bytes.encodeBase64().toString()}"
}
}
}"""
sh """
set +x
echo '${dockerJSON}' > /kaniko/.docker/config.json
"""
}
}
}
stage('Build Container') {
container('kaniko') {
def dockerfile = """FROM ${repository}/dockerhub/library/golang:alpine AS BUILDER
RUN apk --no-cache add git upx && \\
go install github.com/m13253/dns-over-https/doh-server@latest && \\
upx --brute /go/bin/doh-server
FROM ${repository}/library/alpine:latest
RUN addgroup -S -g 1000 app && \\
adduser -S app -G app -h /app -u 1000
USER app
WORKDIR /app
COPY --from=BUILDER /go/bin/doh-server /app/dohserver
ENTRYPOINT ./dohserver
"""
writeFile file: workspace + '/Dockerfile', text: dockerfile
sh "/kaniko/executor --context \"${workspace}\" -f \"${workspace}/Dockerfile\" --destination \"${repository}/library/dohserver:latest\""
}
}
}
}

View File

@@ -0,0 +1,104 @@
def label = "jenkins-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
def repository = "registry.c.test-chamber-13.lan"
def kanikoImage = "${repository}/library/kaniko:latest"
def repositoryCreds = "harbor-repository-creds"
def steamCreds = "steam-credentials"
def steamToken = "steam-token"
def steamTokenName = "ssfn7445013141740368289"
podTemplate(
label: label,
name: templateName,
yaml: functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true,
alpine: true
)
) {
node (label) {
def workspace = pwd()
stage ("Prepare Kaniko") {
container ("kaniko") {
withCredentials([usernameColonPassword(
credentialsId: repositoryCreds,
variable: "dCreds",
)]) {
def dockerJSON = """{
"auths": {
"${repository}": {
"auth": "${dcreds.bytes.encodeBase64().toString()}"
}
}
}"""
sh """
set +x
echo '${dockerJSON}' > /kaniko/.docker/config.json
"""
}
}
}
stage("Kaniko Build & Push") {
container ("kaniko") {
def dockerfile = """
FROM ${repository}/dockerhub/cm2network/steamcmd:latest
LABEL maintainer="The_Spider <spider@smoothnet.org>"
ARG STEAM_USER
ARG STEAM_PASS
ARG STEAM_TOKEN
EXPOSE 16261/udp
EXPOSE 27015/udp
COPY --chown=1000:1000 ./\${STEAM_TOKEN} /home/steam/Steam/\${STEAM_TOKEN}
RUN /home/steam/steamcmd/steamcmd.sh +quit && \\
/home/steam/steamcmd/steamcmd.sh +force_install_dir /home/steam/ProjectZomboid +login "\${STEAM_USER}" "\${STEAM_PASS}" +app_update 380870 validate +quit && \\
rm -f /home/steam/Steam/\${STEAM_TOKEN}
WORKDIR /home/steam/ProjectZomboid
ENTRYPOINT ["/bin/bash", "-c", "/home/steam/ProjectZomboid/start-server.sh"]
"""
writeFile(file: workspace + "/Dockerfile", text: dockerfile)
withCredentials([
usernamePassword(
credentialsId: steamCreds,
usernameVariable: "steamUser",
passwordVariable: "steamPass"
),
file(
credentialsId: steamToken,
variable: "steamTokenFile"
)
]) {
sh "cp " + '${steamTokenFile}' + " ${workspace}/${steamTokenName}"
sh """
/kaniko/executor \\
--context "${workspace}" \\
-f "${workspace}/Dockerfile" \\
--destination "${repository}/library/projectzomboid-server:latest" \\
--single-snapshot \\
--build-arg STEAM_USER="${steamUser}" \\
--build-arg STEAM_PASS="${steamPass}" \\
--build-arg STEAM_TOKEN="${steamTokenName}"
"""
}
}
}
functions.deletePod(
kubeAuth: "rancher-admin-token",
kubeURL: "https://rancher.test-chamber-13.lan/k8s/clusters/c-mc9cq",
namespace: "game-servers",
selector: "workload.user.cattle.io/workloadselector=apps.deployment-game-servers-project-zomboid"
)
}
}

View File

@@ -0,0 +1,140 @@
def label = "kaniko-${UUID.randomUUID().toString()}"
podTemplate(
label: label,
name: "kaniko",
containers: [
containerTemplate(
name: "kaniko",
image: "gcr.io/kaniko-project/executor:debug",
alwaysPullImage: true,
ttyEnabled: true,
command: "/busybox/cat")
],
) {
node (label) {
def workspace = pwd()
stage("Clone Files") {
sh """
git clone https://github.com/RaymiiOrg/ssl-decoder.git
git clone https://github.com/RaymiiOrg/certificate-expiry-monitor.git
"""
}
container ("kaniko") {
stage("Kaniko Build & Push") {
def CE = """
<?php
\$version = 1.4;
\$title = "Certificate Expiry Monitor";
\$current_folder = get_current_folder();
\$timeout = 2;
date_default_timezone_set('UTC');
ini_set('default_socket_timeout', 2);
\$random_blurp = rand(1000,99999);
\$current_domain = "test-chamber-13.lan";
\$current_link = \$current_domain;
\$pre_check_file = '/cert-monitor/pre_checks.json';
\$check_file = '/cert-monitor/checks.json';
\$deleted_check_file = '/cert-monitor/deleted_checks.json';
"""
def MC = """defaults
tls on
tls_certcheck off
tls_starttls on
account default
host example.com
port 25
logfile /var/log/msmtp.log
auto_from on
maildomain smoothnet.org
"""
def AC = """
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule vhost_alias_module /usr/lib/apache2/modules/mod_vhost_alias.so
<VirtualHost _default_:80>
# Compression configuration
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\\.0[678] no-gzip
BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)\$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \\.(?:exe|t?gz|zip|bz2|sit|rar)\$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \\.(?:avi|mov|mp3|mp4|rm|flv|swf|mp?g)\$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \\.pdf\$ no-gzip dont-vary
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Require all granted
Options Indexes MultiViews FollowSymLinks
AllowOverride All
IndexIgnore fancy-index
</Directory>
</VirtualHost>
"""
def DF = """
FROM php:7-apache
RUN apt-get update && \\
mkdir -p /var/www/html/ssl-decoder /var/www/html/certificate-expiry-monitor /cert-monitor && \\
apt-get install -y \\
libicu-dev \\
python2 \\
gettext \\
python-netaddr \\
libcurl4-openssl-dev \\
libonig-dev \\
libxml2-dev \\
libglib2.0-dev \\
libgnutls28-dev \\
automake \\
libtool && \\
apt-get clean && \\
printf '%s\\\n' "sendmail_path = /usr/local/bin/msmtp -t -i" >> /usr/local/etc/php/php.ini && \\
cd /tmp && \\
curl -L https://marlam.de/msmtp/releases/msmtp-1.8.8.tar.xz -o msmtp.tar.xz && \\
tar -x -f msmtp.tar.xz && \\
cd msmtp-1.8.8 && \\
autoreconf -i && \\
./configure && \\
make && \\
make install && \\
rm -rf /tmp/msmtp && \\
touch /var/log/msmtp.log && \\
chmod 777 /var/log/msmtp.log && \\
cd /var/www/html && \\
docker-php-ext-install intl bcmath curl mbstring xml
COPY linux-webserver.conf /etc/apache2/sites-enabled/linux-webserver.conf
COPY ssl-decoder /var/www/html/ssl-decoder
COPY certificate-expiry-monitor /var/www/html/certificate-expiry-monitor
COPY variables.php /var/www/html/certificate-expiry-monitor/functions/variables.php
COPY msmtprc /usr/local/etc/msmtprc
RUN printf '%s' "{}" > /cert-monitor/pre_checks.json && \\
printf '%s' "{}" > /cert-monitor/checks.json && \\
printf '%s' "{}" > /cert-monitor/deleted_checks.json && \\
chown -R 33:33 /var/www/html/* /cert-monitor && \\
sed -i '18s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/ssl-decoder/index.php && \\
sed -i '18s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/index.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/add.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/confirm.php && \\
sed -i '17s/^.*\$/error_reporting(E_ERROR | E_PARSE);/' /var/www/html/certificate-expiry-monitor/unsubscribe.php
"""
writeFile file: workspace + '/linux-webserver.conf', text: AC
writeFile file: workspace + '/variables.php', text: CE
writeFile file: workspace + '/Dockerfile', text: DF
writeFile file: workspace + '/msmtprc', text: MC
sh '/kaniko/executor --insecure --skip-tls-verify --context "' + workspace + '" -f "' + workspace + '/Dockerfile" --destination registry.test-chamber-13.lan:5000/raymii:latest'
}
}
}
}

View File

@@ -0,0 +1,58 @@
#!groovy
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def dockerFile = """FROM ${repository}/library/alpine:latest as builder
LABEL maintainer="The_Spider <spider@smoothnet.org>"
RUN apk add --no-cache curl jq && \\
VER=\$(curl --silent "https://api.github.com/repos/gorcon/rcon-cli/releases/latest" | jq -r '.tag_name' | sed -r 's/v//') && \\
curl --silent \\
--location \\
"https://nexus.c.test-chamber-13.lan/repository/github-releases/gorcon/rcon-cli/releases/download/v\${VER}/rcon-\${VER}-amd64_linux.tar.gz" \\
| \\
tar -z -x -C /tmp -f - && \\
cp /tmp/rcon-\${VER}-amd64_linux/rcon "/tmp/rcon"
FROM ${repository}/library/alpine:latest
RUN addgroup -S -g 1000 rcon && \\
adduser --disabled-password -G rcon --gecos "rcon" --home "/home/rcon" --shell "/sbin/nologin" --uid 1000 rcon
COPY --from=builder --chown=rcon:rcon /tmp/rcon /home/rcon/rcon
USER rcon:rcon
WORKDIR /home/rcon
ENTRYPOINT ["/bin/sh"]
"""
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
podTemplate (
label: label,
name: templateName,
yaml: functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true,
alpine: true
)
){
node (label) {
functions.buildContainer(
repository: repository,
imageDest: "${repository}/library/rcon:latest",
dockerFile: dockerFile,
repoCreds: repositoryCreds,
)
functions.deletePod(
kubeAuth: "rancher-admin-token",
kubeURL: "https://rancher.test-chamber-13.lan/k8s/clusters/c-mc9cq",
namespace: "game-servers",
selector: "app=rcon"
)
}
}

View File

@@ -0,0 +1,47 @@
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def dockerFile = """
FROM ${repository}/dockerhub/cm2network/steamcmd:latest
LABEL maintainer="The_Spider <spider@smoothnet.org>"
EXPOSE 15777/udp
EXPOSE 15000/udp
EXPOSE 777/udp
RUN /home/steam/steamcmd/steamcmd.sh +quit && \\
/home/steam/steamcmd/steamcmd.sh +force_install_dir /home/steam/SatisfactoryDedicatedServer +login anonymous +app_update 1690800 validate +quit
WORKDIR /home/steam/SatisfactoryDedicatedServer
ENTRYPOINT ["/bin/bash" "-c" "./FactoryServer.sh -multihome=0.0.0.0"]
"""
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
podTemplate (
label: label,
name: templateName,
yaml: functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true,
alpine: true
)
){
node (label) {
functions.buildContainer(
repository: repository,
imageDest: "${repository}/library/statafactory-server:latest",
dockerFile: dockerFile,
repoCreds: repositoryCreds,
)
functions.deletePod(
kubeAuth: "rancher-admin-token",
kubeURL: "https://rancher.test-chamber-13.lan/k8s/clusters/c-mc9cq",
namespace: "game-servers",
selector: "app=satasfactory"
)
}
}

View File

@@ -0,0 +1,99 @@
#!groovy
def repository = "registry.c.test-chamber-13.lan"
def repositoryCreds = "harbor-repository-creds"
def dockerFile = """
# Certificate Container
FROM registry.c.test-chamber-13.lan/library/alpine:latest as certHost
# Build Container
FROM registry.c.test-chamber-13.lan/dockerhub/library/golang:alpine AS build
COPY generic-sidecar-injector/ /go/src/app/
WORKDIR /go/src/app
RUN set -x && \\
apk add --no-cache git upx gcc musl-dev && \\
addgroup -S -g 1000 app && \\
adduser --disabled-password -G app --gecos "application account" --home "/home/app" --shell "/sbin/nologin" --no-create-home --uid 1000 app && \\
go mod download && \\
GIT_HASH="\$(git rev-parse --short HEAD)" && \\
GIT_TAG="\$(git tag | tail -1)" && \\
CGO_ENABLED="0" && \\
GOOS="linux" && \\
GOARCH="amd64" && \\
go build \\
-v \\
-tags timetzdata \\
-a \\
-ldflags="-s -w -X 'github.com/salesforce/generic-sidecar-injector/pkg/metrics.gitHash=\${GIT_HASH}' -X 'github.com/salesforce/generic-sidecar-injector/pkg/metrics.gitTag=\${GIT_TAG}' -linkmode external -extldflags '-static'" \\
-installsuffix cgo \\
-o sidecarinjector \\
./cmd/sidecarinjector && \\
upx --lzma sidecarinjector
# Build Image from Scratch
FROM registry.c.test-chamber-13.lan/library/alpine:latest
LABEL maintainer="The_Spider <spider@smoothnet.org>"
COPY --from=certHost /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /etc/passwd /etc/group /etc/
COPY --from=build --chown=app:app /go/src/app/sidecarinjector /app/sidecarinjector
USER app:app
WORKDIR /app/
ENTRYPOINT ["/app/sidecarinjector"]
"""
def label = "kubernetes-${UUID.randomUUID().toString()}"
def templateName = "pipeline-worker"
podTemplate(
label: label,
name: templateName,
yaml: functions.podYaml(
repo: repository,
templateName: templateName,
kaniko: true
)
) {
node (label) {
stage ("Pull generic-sidecar-injector source") {
dir("generic-sidecar-injector") {
checkout ([
$class: "GitSCM",
branches: [
[
name: "refs/heads/master",
],
],
userRemoteConfigs: [
[
url: "https://github.com/salesforce/generic-sidecar-injector.git",
],
],
extensions: [
[
$class: "CloneOption",
shallow: true,
],
[
$class: "CheckoutOption",
timeout: 2,
],
],
])
}
}
functions.buildContainer(
repository: repository,
imageDest: "${repository}/library/generic-sidecar-injector:latest",
dockerFile: dockerFile,
repoCreds: repositoryCreds,
)
}
}