add first version of ssh-agent publishing

This commit is contained in:
InsanusMokrassar 2024-05-29 22:43:36 +06:00
parent 70e4add59e
commit 26ec3ec493
5 changed files with 76 additions and 6 deletions

View File

@ -4,7 +4,7 @@ on:
branches: branches:
- master - master
jobs: jobs:
publishing: publish_jenkins:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
@ -21,3 +21,22 @@ jobs:
run: ./autoupdate.sh run: ./autoupdate.sh
- name: Deploy - name: Deploy
run: ./deploy run: ./deploy
publish_jenkins_ssh-agent:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log into registry
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Update version
working-directory: ./ssh-agent/
run: ./autoupdate.sh
- name: Deploy
working-directory: ./ssh-agent/
run: ./deploy

11
deploy
View File

@ -10,9 +10,10 @@ function assert_success() {
} }
version="2.426.1" version="2.426.1"
image_name=jenkins
assert_success docker build -t jenkins:$version ./ assert_success docker build -t $image_name:$version ./
assert_success docker tag jenkins:$version insanusmokrassar/jenkins:$version assert_success docker tag $image_name:$version insanusmokrassar/$image_name:$version
assert_success docker tag jenkins:$version insanusmokrassar/jenkins:latest assert_success docker tag $image_name:$version insanusmokrassar/$image_name:latest
assert_success docker push insanusmokrassar/jenkins:$version assert_success docker push insanusmokrassar/$image_name:$version
assert_success docker push insanusmokrassar/jenkins:latest assert_success docker push insanusmokrassar/$image_name:latest

20
ssh-agent/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM jenkins/ssh-agent:5.38.0-debian-jdk17 as ssh-agent
LABEL maintainer="ovsyannikov.alexey95@gmail.com"
USER root
RUN mv /bin/sh /bin/sh.old && ln -s /bin/bash /bin/sh
ENV TZ=Etc/GMT
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt update && apt -y install wget gnupg2 zip unzip curl sudo git software-properties-common pass axel
RUN chmod 777 /tmp
USER jenkins
RUN curl -s "https://get.sdkman.io" | bash
RUN source "$HOME/.sdkman/bin/sdkman-init.sh" &&\
sdk install java `sdk ls java | grep librca | grep " 17" | grep -m 1 -Eo "(.?[0-9]{1,2}){3}" | head -1`-librca &&\
sdk default java `sdk ls java | grep librca | grep " 17" | grep -m 1 -Eo "(.?[0-9]{1,2}){3}" | head -1`-librca

11
ssh-agent/autoupdate.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
if [ -z "$1" ]; then
newVersion="5.38.0"
else
newVersion="$1"
fi
sed -i -E "s/ssh-agent:[0-9\.]+/ssh-agent:${newVersion}/g" Dockerfile
sed -i -E "s/version=\"[0-9\.]+\"/version=\"${newVersion}\"/g" deploy

19
ssh-agent/deploy Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
function assert_success() {
"${@}"
local status=${?}
if [ ${status} -ne 0 ]; then
echo "### Error ${status} at: ${BASH_LINENO[*]} ###"
exit ${status}
fi
}
version="5.38.0"
image_name=jenkins-ssh-agent
assert_success docker build -t $image_name:$version ./
assert_success docker tag $image_name:$version insanusmokrassar/$image_name:$version
assert_success docker tag $image_name:$version insanusmokrassar/$image_name:latest
assert_success docker push insanusmokrassar/$image_name:$version
assert_success docker push insanusmokrassar/$image_name:latest