Merge pull request #1591 from 4s3ti/test

Ubuntu jammy Support and multiple updates to jammy
This commit is contained in:
4s3ti 2022-08-21 20:48:55 +02:00 committed by GitHub
commit 64be511cec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 152 additions and 123 deletions

28
.releaserc Normal file
View file

@ -0,0 +1,28 @@
{
"name": "pivpn",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogFile": "./CHANGELOG.md"
}
],
["@semantic-release/github", {
"assets": [
{"path": "dist/asset.min.css", "label": "CSS distribution"},
{"path": "dist/asset.min.js", "label": "JS distribution"}
]
}]
],
"release": {
"branches": [ "master", "beta", "test" ]
},
"branches": [
{name: 'master'},
{name: 'beta', channel: 'beta', prerelease: true},
{name: 'test', channel: 'test', prerelease: true}
]
}

View file

@ -11,6 +11,7 @@ stages:
- lint - lint
- style - style
- test - test
- release
branches: branches:
only: only:
@ -21,7 +22,7 @@ jobs:
include: include:
- stage: lint - stage: lint
name: "Shellcheck lint" name: "Shellcheck lint"
dist: focal dist: jammy
addons: addons:
apt: apt:
packages: packages:
@ -35,7 +36,7 @@ jobs:
- stage: style - stage: style
name: "Shell Style Guide" name: "Shell Style Guide"
dist: xenial dist: jammy
addons: addons:
snaps: snaps:
- shfmt - shfmt
@ -47,151 +48,106 @@ jobs:
- find scripts/ -type f -exec shfmt -d -i 2 -ci -sr -bn {} \; - find scripts/ -type f -exec shfmt -d -i 2 -ci -sr -bn {} \;
- stage: test - stage: test
name: "OpenVPN Xenial & Commands" name: "OpenVPN Bionic (18.04)"
dist: xenial
virt: vm
arch: amd64
before_script:
- cat /etc/os-release
- uname -a
- ip a
- sudo chmod +x ciscripts/startup.sh
- ./ciscripts/startup.sh -o
script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_openvpn.conf
after_script:
- systemctl status openvpn
- pivpn add -n foo nopass -d 180
- pivpn add -p "$RANDOM$RANDOM" -n bar -d 180
- pivpn add -o -n foo
- pivpn -bk
- ls ~pi/pivpnbackup/ | grep backup
- pivpn -l
- pivpn -c
- pivpn -r foo -y
after_fail:
- sudo journalctl -xe
- stage: test
name: "Wireguard Xenial & Commands"
dist: xenial
virt: vm
arch: amd64
before_script:
- cat /etc/os-release
- uname -a
- ip a
- sudo chmod +x ciscripts/startup.sh
- ./ciscripts/startup.sh -w
script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_wireguard.conf
after_script:
- systemctl status wg-quick@wg0
- pivpn add -n foo
- pivpn -qr foo
- pivpn -bk
- ls ~pi/pivpnbackup/ | grep backup
- pivpn -l
- pivpn -c
- pivpn -r foo -y
after_fail:
- sudo journalctl -xe
- stage: test
name: "OpenVPN Bionic & Commands"
dist: bionic dist: bionic
virt: vm virt: vm
arch: amd64 arch: amd64
before_script: before_script:
- cat /etc/os-release - sudo chmod +x ciscripts/*.sh
- uname -a - ./ciscripts/pre_checks.sh
- ip a
- sudo chmod +x ciscripts/startup.sh
- ./ciscripts/startup.sh -o - ./ciscripts/startup.sh -o
script: script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_openvpn.conf - sudo ./auto_install/install.sh --unattended ciscripts/ci_openvpn.conf
- systemctl status openvpn - ./ciscripts/test.sh -o
- pivpn add -n foo nopass -d 180
- pivpn add -p "$RANDOM$RANDOM" -n bar -d 180
- pivpn add -o -n foo
- pivpn -bk
- ls ~pi/pivpnbackup/ | grep backup
- pivpn -l
- pivpn -c
- pivpn -r foo -y
after_fail: after_fail:
- sudo journalctl -xe - sudo journalctl -xe
- stage: test - stage: test
name: "Wireguard Bionic & Commands" name: "Wireguard Bionic (18.04)"
dist: bionic dist: bionic
virt: vm virt: vm
arch: amd64 arch: amd64
before_script: before_script:
- cat /etc/os-release - sudo chmod +x ciscripts/*.sh
- uname -a - ./ciscripts/pre_checks.sh
- ip a
- sudo apt update -y
- sudo chmod +x ciscripts/startup.sh
- ./ciscripts/startup.sh -w - ./ciscripts/startup.sh -w
script: script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_wireguard.conf - sudo ./auto_install/install.sh --unattended ciscripts/ci_wireguard.conf
- systemctl status wg-quick@wg0 - ./ciscripts/test.sh -w
- pivpn add -n foo
- pivpn -qr foo
- pivpn -bk
- ls ~pi/pivpnbackup/ | grep backup
- pivpn -l
- pivpn -c
- pivpn -r foo -y
after_fail: after_fail:
- sudo journalctl -xe - sudo journalctl -xe
- stage: test - stage: test
name: "OpenVPN Focal & Commands" name: "OpenVPN Focal (20.04)"
dist: focal dist: focal
virt: vm virt: vm
arch: amd64 arch: amd64
before_script: before_script:
- cat /etc/os-release - sudo chmod +x ciscripts/*.sh
- uname -a - ./ciscripts/pre_checks.sh
- ip a
- sudo chmod +x ciscripts/startup.sh
- ./ciscripts/startup.sh -o - ./ciscripts/startup.sh -o
script: script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_openvpn.conf - sudo ./auto_install/install.sh --unattended ciscripts/ci_openvpn.conf
- systemctl status openvpn - ./ciscripts/test.sh -o
- pivpn add -n foo nopass -d 180
- pivpn add -p "$RANDOM$RANDOM" -n bar -d 180
- pivpn add -o -n foo
- pivpn -bk
- ls ~pi/pivpnbackup/ | grep backup
- pivpn -l
- pivpn -c
- pivpn -r foo -y
after_fail: after_fail:
- sudo journalctl -xe - sudo journalctl -xe
- stage: test - stage: test
name: "Wireguard Focal & Commands" name: "Wireguard Focal (20.04)"
dist: focal dist: focal
virt: vm virt: vm
arch: amd64 arch: amd64
before_script: before_script:
- cat /etc/os-release - sudo chmod +x ciscripts/*.sh
- uname -a - ./ciscripts/pre_checks.sh
- ip a
- sudo chmod +x ciscripts/startup.sh
- ./ciscripts/startup.sh -w - ./ciscripts/startup.sh -w
script: script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_wireguard.conf - sudo ./auto_install/install.sh --unattended ciscripts/ci_wireguard.conf
- systemctl status wg-quick@wg0 - ./ciscripts/test.sh -w
- pivpn add -n foo
- pivpn -qr foo
- pivpn -bk
- ls ~pi/pivpnbackup/ | grep backup
- pivpn -l
- pivpn -c
- pivpn -r foo -y
after_fail: after_fail:
- sudo journalctl -xe - sudo journalctl -xe
- stage: test
name: "OpenVPN Jammy (22.04)"
dist: jammy
virt: vm
arch: amd64
before_script:
- sudo chmod +x ciscripts/*.sh
- ./ciscripts/pre_checks.sh
- ./ciscripts/startup.sh -o
script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_openvpn.conf
- ./ciscripts/test.sh -o
after_fail:
- sudo journalctl -xe
- stage: test
name: "Wireguard Jammy (22.04)"
dist: jammy
virt: vm
arch: amd64
before_script:
- sudo chmod +x ciscripts/*.sh
- ./ciscripts/pre_checks.sh
- ./ciscripts/startup.sh -w
script:
- sudo ./auto_install/install.sh --unattended ciscripts/ci_wireguard.conf
- ./ciscripts/test.sh -w
after_fail:
- sudo journalctl -xe
- stage: "release"
name: "release"
if: type = push
dist: jammy
virt: vm
arch: amd64
language: node_js
node_js:
- "node"
install:
- npm install @semantic-release/github -D
- npm install @semantic-release/changelog -D
script:
- npx semantic-release

View file

@ -351,7 +351,8 @@ distroCheck() {
["11"]="bullseye" ["11"]="bullseye"
["16.04"]="xenial" ["16.04"]="xenial"
["18.04"]="bionic" ["18.04"]="bionic"
["20.04"]="focal") ["20.04"]="focal"
["22.04"]="jammy")
OSCN="${VER_MAP["${VER}"]}" OSCN="${VER_MAP["${VER}"]}"
# Alpine support # Alpine support
@ -363,7 +364,7 @@ distroCheck() {
case "${PLAT}" in case "${PLAT}" in
Debian | Raspbian | Ubuntu) Debian | Raspbian | Ubuntu)
case "${OSCN}" in case "${OSCN}" in
stretch | buster | bullseye | xenial | bionic | focal) stretch | buster | bullseye | xenial | bionic | focal | jammy)
: :
;; ;;
*) *)

5
ciscripts/pre_checks.sh Normal file
View file

@ -0,0 +1,5 @@
#/bin/bash -e
cat /etc/os-release
uname -a
ip a

View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash -e
interface=$(ip -o link \ interface=$(ip -o link \
| awk '{print $2}' \ | awk '{print $2}' \

View file

@ -1,14 +1,53 @@
#!/bin/bash #!/bin/bash -e
# Tests multiple pivpn commands
testopenvpn() {
if command -v systemctl > /dev/null; then if command -v systemctl > /dev/null; then
systemctl status openvpn systemctl status openvpn
elif command -v rc-service > /dev/null; then elif command -v rc-service > /dev/null; then
rc-service openvpn status rc-service openvpn status
fi fi
pivpn add -n foo pivpn add -n foo nopass -d 180
pivpn -qr foo pivpn add -p "$RANDOM$RANDOM" -n bar -d 180
pivpn add -o -n foo
pivpn -bk pivpn -bk
sudo ls ~pi/pivpnbackup/ | grep backup
pivpn -l pivpn -l
pivpn -c pivpn -c
pivpn -r foo -y pivpn -r foo -y
exit 0
}
testwireguard() {
if command -v systemctl > /dev/null; then
systemctl status wg-quick@wg0
elif command -v rc-service > /dev/null; then
rc-service wg-quick status
fi
pivpn add -n foo
pivpn -qr foo
pivpn -bk
sudo ls ~pi/pivpnbackup/ | grep backup
pivpn -l
pivpn -c
pivpn -r foo -y
exit 0
}
while true; do
case "${1}" in
-o | --openvpn)
testopenvpn
;;
-w | --wireguard)
testwireguard
;;
*)
err "unknown VPN protocol"
exit 1
;;
esac
done