def repository = "registry.c.test-chamber-13.lan" def repositoryCreds = "harbor-repository-creds" def puttyZipFile def templateName = "pipeline-worker" def workspace pipeline { agent { kubernetes { yaml functions.podYaml( repo: repository, templateName: templateName, alpine: true, ) } } stages { stage('Initalize Jenkins') { steps { script { workspace = pwd() } } } stage('Pull Source Code') { steps { script { dir("yt-dlp") { checkout([ $class: "GitSCM", branches: [ [ name: "refs/heads/master", ], ], userRemoteConfigs: [ [ url: "ssh://git@gitea.c.test-chamber-13.lan:31822/nhyatt/yt-dlp.git", credentialsId: "Gitea-Read-Only-Token", ], ], extensions: [ [ $class: "CloneOption", shallow: true, ], [ $class: "CheckoutOption", timeout: 2, ], ], ]) } } } } stage('Prepare Build Container') { steps { container('alpine') { script { sh """ apk add --no-cache \ py3-pip \ gcc \ g++ \ texlive \ zip \ make \ curl \ jq \ pytest curl \ --silent \ --location \ "\$( \ printf '%s' "\$( \ curl \ --location \ --silent \ "https://api.github.com/repos/jgm/pandoc/releases" \ | \ jq \ --raw-output \ '.[0].assets[] | select (.name|test("linux-amd64")) | .browser_download_url' \ )" \ | \ sed \ -r \ -e \ 's/https:\\/\\/github.com\\//https:\\/\\/nexus.c.test-chamber-13.lan\\/repository\\/github-releases\\//' \ )" \ | \ tar \ --gzip \ --extract \ --directory /tmp \ --file - mv /tmp/pandoc-*/bin/pandoc /usr/local/bin/pandoc """ } } } } stage('Compile Binary') { steps { container('alpine') { script { sh """ cd ${workspace}/yt-dlp make """ } } } } stage('Store Artifacts') { steps { script { archiveArtifacts (artifacts: "yt-dlp/yt-dlp", fingerprint: true, allowEmptyArchive: false, onlyIfSuccessful: true, ) } } } stage ('Push Artifacts') { steps { container('alpine') { script { declarativeFunctions.pushArtifact( repoCreds: "nexus-generic-upload-bot", fileName: "yt-dlp", filePath: workspace + "/yt-dlp/", fileURL: "https://nexus.c.test-chamber-13.lan/repository/generic/yt-dlp/" ) } } } } } }