From aa06258e1be30d80b2fc819953a00145cbd71721 Mon Sep 17 00:00:00 2001 From: Kristo Copani Date: Sat, 30 Nov 2024 04:29:08 +0200 Subject: [PATCH 1/5] jenkins --- ct/jenkins.sh | 98 ++++++++++++++++++++++++++++++++++++++ install/jenkins-install.sh | 54 +++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 ct/jenkins.sh create mode 100644 install/jenkins-install.sh diff --git a/ct/jenkins.sh b/ct/jenkins.sh new file mode 100644 index 00000000..955a2845 --- /dev/null +++ b/ct/jenkins.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash +source <(curl -s https://raw.githubusercontent.com/quantumryuu/ProxmoxVE/build/misc/build.func) +#source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2024 community-scripts ORG +# Author: kristocopani +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +function header_info { +clear +cat <<"EOF" + ____ ________ ______ __ + / _/___ _________ / _/ __ \/ ____/___/ / + / // __ \/ ___/ __ \ / // /_/ / / / __ / + _/ // / / (__ ) /_/ // // _, _/ /___/ /_/ / +/___/_/ /_/____/ .___/___/_/ |_|\____/\__,_/ + /_/ + +EOF +} +header_info +echo -e "Loading..." +APP="InspIRCd" +var_disk="2" +var_cpu="1" +var_ram="512" +var_os="debian" +var_version="12" +variables +color +catch_errors + +function default_settings() { + CT_TYPE="1" + PW="" + CT_ID=$NEXTID + HN=$NSAPP + DISK_SIZE="$var_disk" + CORE_COUNT="$var_cpu" + RAM_SIZE="$var_ram" + BRG="vmbr0" + NET="dhcp" + GATE="" + APT_CACHER="" + APT_CACHER_IP="" + DISABLEIP6="no" + MTU="" + SD="" + NS="" + MAC="" + VLAN="" + SSH="no" + VERB="no" + echo_default +} +function update_script() { +header_info +check_container_storage +check_container_resources + + if [[ ! -f /lib/systemd/system/inspircd.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/inspircd/inspircd/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Service" + systemctl stop inspircd + msg_ok "Stopped Service" + + msg_info "Updating ${APP} to v${RELEASE}" + cd /opt + wget -q https://github.com/inspircd/inspircd/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u1_amd64.deb + apt-get install "./inspircd_${RELEASE}.deb12u1_amd64.deb" -y &>/dev/nul + echo "${RELEASE}" >"/opt/${APP}_version.txt" + msg_ok "Updated ${APP} to v${RELEASE}" + + msg_info "Starting Service" + systemctl start inspircd + msg_ok "Started Service" + + msg_info "Cleaning up" + rm -rf /opt/inspircd_${RELEASE}.deb12u1_amd64.deb + msg_ok "Cleaned" + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}." + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${APP} should be reachable by going to the following URL. + ${BL}http://${IP}:3000${CL} \n" diff --git a/install/jenkins-install.sh b/install/jenkins-install.sh new file mode 100644 index 00000000..dede9390 --- /dev/null +++ b/install/jenkins-install.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2024 community-scripts ORG +# Author: kristocopani +# License: MIT +# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt-get install -y \ + curl \ + mc \ + sudo +msg_ok "Installed Dependencies" + + +msg_info "Installing InspIRCd" +RELEASE=$(curl -s https://api.github.com/repos/REPO/REPO/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +cd /opt +wget -q https://github.com/REPO/REPO/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u1_amd64.deb +$STD apt-get install "./inspircd_${RELEASE}.deb12u1_amd64.deb" -y &>/dev/null +cat </etc/inspircd/inspircd.conf + + + + + + +EOF + +echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" +msg_ok "Installed InspIRCd" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf /opt/inspircd_${RELEASE}.deb12u1_amd64.deb +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From fa88e29e4ea8af424e253a51079ca4f4a62ffaa8 Mon Sep 17 00:00:00 2001 From: Kristo Copani Date: Sat, 30 Nov 2024 04:52:12 +0200 Subject: [PATCH 2/5] Initial --- ct/jenkins.sh | 53 ++++++++------------------------------ install/jenkins-install.sh | 34 +++++++----------------- json/jenkins.json | 34 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 66 deletions(-) create mode 100644 json/jenkins.json diff --git a/ct/jenkins.sh b/ct/jenkins.sh index 955a2845..1db23b2d 100644 --- a/ct/jenkins.sh +++ b/ct/jenkins.sh @@ -9,21 +9,20 @@ source <(curl -s https://raw.githubusercontent.com/quantumryuu/ProxmoxVE/build/m function header_info { clear cat <<"EOF" - ____ ________ ______ __ - / _/___ _________ / _/ __ \/ ____/___/ / - / // __ \/ ___/ __ \ / // /_/ / / / __ / - _/ // / / (__ ) /_/ // // _, _/ /___/ /_/ / -/___/_/ /_/____/ .___/___/_/ |_|\____/\__,_/ - /_/ - + __ __ _ + / /__ ____ / /__(_)___ _____ + __ / / _ \/ __ \/ //_/ / __ \/ ___/ +/ /_/ / __/ / / / ,< / / / / (__ ) +\____/\___/_/ /_/_/|_/_/_/ /_/____/ + EOF } header_info echo -e "Loading..." -APP="InspIRCd" -var_disk="2" -var_cpu="1" -var_ram="512" +APP="Jenkins" +var_disk="4" +var_cpu="2" +var_ram="1024" var_os="debian" var_version="12" variables @@ -57,36 +56,6 @@ function update_script() { header_info check_container_storage check_container_resources - - if [[ ! -f /lib/systemd/system/inspircd.service ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - RELEASE=$(curl -s https://api.github.com/repos/inspircd/inspircd/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Stopping Service" - systemctl stop inspircd - msg_ok "Stopped Service" - - msg_info "Updating ${APP} to v${RELEASE}" - cd /opt - wget -q https://github.com/inspircd/inspircd/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u1_amd64.deb - apt-get install "./inspircd_${RELEASE}.deb12u1_amd64.deb" -y &>/dev/nul - echo "${RELEASE}" >"/opt/${APP}_version.txt" - msg_ok "Updated ${APP} to v${RELEASE}" - - msg_info "Starting Service" - systemctl start inspircd - msg_ok "Started Service" - - msg_info "Cleaning up" - rm -rf /opt/inspircd_${RELEASE}.deb12u1_amd64.deb - msg_ok "Cleaned" - msg_ok "Updated Successfully" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}." - fi - exit } start @@ -95,4 +64,4 @@ description msg_ok "Completed Successfully!\n" echo -e "${APP} should be reachable by going to the following URL. - ${BL}http://${IP}:3000${CL} \n" + ${BL}http://${IP}:8080${CL} \n" \ No newline at end of file diff --git a/install/jenkins-install.sh b/install/jenkins-install.sh index dede9390..9ae38699 100644 --- a/install/jenkins-install.sh +++ b/install/jenkins-install.sh @@ -17,38 +17,24 @@ msg_info "Installing Dependencies" $STD apt-get install -y \ curl \ mc \ - sudo + sudo \ + fontconfig \ + openjdk-17-jre msg_ok "Installed Dependencies" -msg_info "Installing InspIRCd" -RELEASE=$(curl -s https://api.github.com/repos/REPO/REPO/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -cd /opt -wget -q https://github.com/REPO/REPO/releases/download/v${RELEASE}/inspircd_${RELEASE}.deb12u1_amd64.deb -$STD apt-get install "./inspircd_${RELEASE}.deb12u1_amd64.deb" -y &>/dev/null -cat </etc/inspircd/inspircd.conf - - - - - - -EOF - -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" +msg_info "Installing Jenkins" +wget -qO /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian/jenkins.io-2023.key +echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" https://pkg.jenkins.io/debian binary/ >/etc/apt/sources.list.d/jenkins.list +$STD apt-get update +$STD apt-get install jenkins +echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" #Will not be updatable so probably I should remove this line? msg_ok "Installed InspIRCd" motd_ssh customize msg_info "Cleaning up" -rm -rf /opt/inspircd_${RELEASE}.deb12u1_amd64.deb $STD apt-get -y autoremove $STD apt-get -y autoclean -msg_ok "Cleaned" +msg_ok "Cleaned" \ No newline at end of file diff --git a/json/jenkins.json b/json/jenkins.json new file mode 100644 index 00000000..b4549e4e --- /dev/null +++ b/json/jenkins.json @@ -0,0 +1,34 @@ +{ + "name": "Jenkins", + "slug": "jenkins", + "categories": [ + 3 + ], + "date_created": "2024-11-30", + "type": "ct", + "updateable": false, + "privileged": false, + "interface_port": 8080, + "documentation": "https://www.jenkins.io/doc/", + "website": "https://www.jenkins.io/", + "logo": "https://www.jenkins.io/images/logos/jenkins/jenkins.svg", + "description": "Jenkins provides hundreds of plugins to support building, deploying and automating any project. ", + "install_methods": [ + { + "type": "default", + "script": "/ct/jenkins.sh", + "resources": { + "cpu": 2, + "ram": 1024, + "hdd": 4, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] + } \ No newline at end of file From 307eeae1f0038ec8e7b19a170171a77b51398b11 Mon Sep 17 00:00:00 2001 From: Kristo Copani Date: Sat, 30 Nov 2024 05:02:33 +0200 Subject: [PATCH 3/5] tests --- install/jenkins-install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/install/jenkins-install.sh b/install/jenkins-install.sh index 9ae38699..e3f1df92 100644 --- a/install/jenkins-install.sh +++ b/install/jenkins-install.sh @@ -24,12 +24,11 @@ msg_ok "Installed Dependencies" msg_info "Installing Jenkins" -wget -qO /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian/jenkins.io-2023.key +wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian/jenkins.io-2023.key echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" https://pkg.jenkins.io/debian binary/ >/etc/apt/sources.list.d/jenkins.list -$STD apt-get update -$STD apt-get install jenkins -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" #Will not be updatable so probably I should remove this line? -msg_ok "Installed InspIRCd" +apt-get update +apt-get install jenkins +msg_ok "Installed Jenkins" motd_ssh customize From d8d7429ee80433358635dfd023898e89dfb7c725 Mon Sep 17 00:00:00 2001 From: Kristo Copani Date: Sat, 30 Nov 2024 05:06:30 +0200 Subject: [PATCH 4/5] fix fix fix --- install/jenkins-install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install/jenkins-install.sh b/install/jenkins-install.sh index e3f1df92..a0c406da 100644 --- a/install/jenkins-install.sh +++ b/install/jenkins-install.sh @@ -24,10 +24,11 @@ msg_ok "Installed Dependencies" msg_info "Installing Jenkins" -wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian/jenkins.io-2023.key +wget -qO /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian/jenkins.io-2023.key echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" https://pkg.jenkins.io/debian binary/ >/etc/apt/sources.list.d/jenkins.list -apt-get update -apt-get install jenkins +$STD apt-get update +$STD apt-get install -y \ + jenkins msg_ok "Installed Jenkins" motd_ssh From 1b930609816aa77674b78a39760b634bca10c559 Mon Sep 17 00:00:00 2001 From: Kristo Copani Date: Sat, 30 Nov 2024 05:21:14 +0200 Subject: [PATCH 5/5] Ready for PR! --- ct/jenkins.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ct/jenkins.sh b/ct/jenkins.sh index 1db23b2d..056d3d20 100644 --- a/ct/jenkins.sh +++ b/ct/jenkins.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -source <(curl -s https://raw.githubusercontent.com/quantumryuu/ProxmoxVE/build/misc/build.func) -#source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2024 community-scripts ORG # Author: kristocopani # License: MIT