This commit is contained in:
Drake Marino 2024-06-06 21:00:43 -05:00
parent 086f47cab0
commit 013dc5572b
2 changed files with 49 additions and 51 deletions

65
Jenkinsfile vendored
View File

@ -50,32 +50,32 @@ pipeline {
def remote = [
name : 'HostServer',
host : '192.168.0.216',
user : '$JOBLINK_LOCAL_USER',
password : '$JOBLINK_LOCAL_PASSWD',
user : '${env.JOBLINK_LOCAL_USER}',
password : '${env.JOBLINK_LOCAL_PASSWD}',
allowAnyHosts: true,
]
if (env.BRANCH_NAME == 'main') {
sshRemove(path: '/home/$JOBLINK_LOCAL_USER/builds/main/linux', remote: remote)
sshCommand remote: remote, command: "mkdir /home/$JOBLINK_LOCAL_USER/builds/main/linux"
sshPut(from: 'build/linux/x64/release', into: '/home/$JOBLINK_LOCAL_USER/builds/main/linux', remote: remote)
sshCommand remote: remote, command: "mv /home/$JOBLINK_LOCAL_USER/builds/main/linux/release/* /home/$JOBLINK_LOCAL_USER/builds/main/linux"
sshCommand remote: remote, command: "rm -R /home/$JOBLINK_LOCAL_USER/builds/main/linux/release/"
sshRemove(path: '/home/$JOBLINK_LOCAL_USER/builds/main/apk', remote: remote)
sshCommand remote: remote, command: "mkdir /home/$JOBLINK_LOCAL_USER/builds/main/apk"
sshPut(from: 'build/app/outputs/apk/release', into: '/home/$JOBLINK_LOCAL_USER/builds/main/apk', remote: remote)
sshCommand remote: remote, command: "mv /home/$JOBLINK_LOCAL_USER/builds/main/apk/release/* /home/$JOBLINK_LOCAL_USER/builds/main/apk"
sshCommand remote: remote, command: "rm -R /home/$JOBLINK_LOCAL_USER/builds/main/apk/release/"
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/linux', remote: remote)
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux"
sshPut(from: 'build/linux/x64/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/linux', remote: remote)
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux"
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/main/linux/release/"
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/apk', remote: remote)
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk"
sshPut(from: 'build/app/outputs/apk/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/main/apk', remote: remote)
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk"
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/main/apk/release/"
} else {
sshRemove(path: '/home/$JOBLINK_LOCAL_USER/builds/dev/linux', remote: remote)
sshCommand remote: remote, command: "mkdir /home/$JOBLINK_LOCAL_USER/builds/dev/linux"
sshPut(from: 'build/linux/x64/release', into: '/home/$JOBLINK_LOCAL_USER/builds/dev/linux', remote: remote)
sshCommand remote: remote, command: "mv /home/$JOBLINK_LOCAL_USER/builds/dev/linux/release/* /home/$JOBLINK_LOCAL_USER/builds/dev/linux"
sshCommand remote: remote, command: "rm -R /home/$JOBLINK_LOCAL_USER/builds/dev/linux/release/"
sshRemove(path: '/home/$JOBLINK_LOCAL_USER/builds/dev/apk', remote: remote)
sshCommand remote: remote, command: "mkdir /home/$JOBLINK_LOCAL_USER/builds/dev/apk"
sshPut(from: 'build/app/outputs/apk/release', into: '/home/$JOBLINK_LOCAL_USER/builds/dev/apk', remote: remote)
sshCommand remote: remote, command: "mv /home/$JOBLINK_LOCAL_USER/builds/dev/apk/release/* /home/$JOBLINK_LOCAL_USER/builds/dev/apk"
sshCommand remote: remote, command: "rm -R /home/$JOBLINK_LOCAL_USER/builds/dev/apk/release/"
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux', remote: remote)
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux"
sshPut(from: 'build/linux/x64/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux', remote: remote)
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux"
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/dev/linux/release/"
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk', remote: remote)
sshCommand remote: remote, command: "mkdir /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk"
sshPut(from: 'build/app/outputs/apk/release', into: '/home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk', remote: remote)
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk/release/* /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk"
sshCommand remote: remote, command: "rm -R /home/${env.JOBLINK_LOCAL_USER}/builds/dev/apk/release/"
}
}
}
@ -92,14 +92,14 @@ pipeline {
name : 'MarinoDev',
host : 'marinodev.com',
port : 21098,
user : '$JOBLINK_REMOTE_USER',
user : '${env.JOBLINK_REMOTE_USER}',
identityFile : '/var/jenkins_home/marinoDevPrivateKey',
passphrase : '$JOBLINK_REMOTE_PASSWD',
passphrase : '${env.JOBLINK_REMOTE_PASSWD}',
allowAnyHosts: true,
]
sshRemove(path: '/home/$JOBLINK_REMOTE_USER/public_html/fbla', remote: remote)
sshPut(from: '/var/jenkins_home/workspace/fbla-ui_main/build/web/', into: '/home/$JOBLINK_REMOTE_USER/public_html/', remote: remote)
sshCommand remote: remote, command: "mv /home/$JOBLINK_REMOTE_USER/public_html/web /home/$JOBLINK_REMOTE_USER/public_html/fbla"
sshRemove(path: '/home/${env.JOBLINK_REMOTE_USER}/public_html/fbla', remote: remote)
sshPut(from: '/var/jenkins_home/workspace/fbla-ui_main/build/web/', into: '/home/${env.JOBLINK_REMOTE_USER}/public_html/', remote: remote)
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_REMOTE_USER}/public_html/web /home/${env.JOBLINK_REMOTE_USER}/public_html/fbla"
}
}
}
@ -109,14 +109,13 @@ pipeline {
def remote = [
name : 'HostServer',
host : '192.168.0.216',
user : '$JOBLINK_LOCAL_USER',
password : '$JOBLINK_LOCAL_PASSWD',
user : "${env.JOBLINK_LOCAL_USER}",
password : "${env.JOBLINK_LOCAL_PASSWD}",
allowAnyHosts: true,
]
sh 'echo $JOBLINK_LOCAL_USER $JOBLINK_LOCAL_PASSWD'
sshRemove(path: '/home/$JOBLINK_LOCAL_USER/fbla-webserver/webfiles/fbla', remote: remote)
sshPut(from: 'build/web/', into: '/home/$JOBLINK_LOCAL_USER/fbla-webserver', remote: remote)
sshCommand remote: remote, command: "mv /home/$JOBLINK_LOCAL_USER/fbla-webserver/web /home/$JOBLINK_LOCAL_USER/fbla-webserver/webfiles/fbla"
sshRemove(path: '/home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/webfiles/fbla', remote: remote)
sshPut(from: 'build/web/', into: '/home/${env.JOBLINK_LOCAL_USER}/fbla-webserver', remote: remote)
sshCommand remote: remote, command: "mv /home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/web /home/${env.JOBLINK_LOCAL_USER}/fbla-webserver/webfiles/fbla"
}
}
}

View File

@ -1,18 +1,17 @@
import 'dart:convert';
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
import 'package:fbla_api/fbla_api.dart';
import 'package:test/test.dart';
import 'package:http/http.dart' as http;
import 'dart:io';
import 'package:dart_jsonwebtoken/dart_jsonwebtoken.dart';
import 'package:fbla_api/fbla_api.dart';
import 'package:http/http.dart' as http;
import 'package:test/test.dart';
final apiAddress = 'https://homelab.marinodev.com';
SecretKey secretKey = SecretKey(Platform.environment['SECRET_KEY']!);
SecretKey secretKey = SecretKey(Platform.environment['JOBLINK_SECRET_KEY']!);
void main() async {
final jwt = JWT(
{
'username': 'tmp'
},
{'username': 'tmp'},
);
final token = jwt.sign(secretKey);
@ -43,7 +42,8 @@ void main() async{
"password": "tmp"
}
''';
var response = await http.post(Uri.parse('$apiAddress, /fbla-api/createuser'),
var response = await http.post(
Uri.parse('$apiAddress, /fbla-api/createuser'),
body: json,
headers: {'Authorization': token}).timeout(const Duration(seconds: 20));
expect(response.statusCode, 200);
@ -70,11 +70,9 @@ void main() async{
"username": "tmp"
}
''';
var response = await http.post(
Uri.parse('$apiAddress/fbla-api/deleteuser'),
var response = await http.post(Uri.parse('$apiAddress/fbla-api/deleteuser'),
body: json,
headers: {'Authorization': token}).timeout(const Duration(seconds: 20)
);
headers: {'Authorization': token}).timeout(const Duration(seconds: 20));
expect(response.statusCode, 200);
expect(response.body, 'tmp');
});
@ -94,7 +92,8 @@ void main() async{
"locationAddress": "tmp"
}
''';
var response = await http.post(Uri.parse('$apiAddress/fbla-api/createbusiness'),
var response = await http.post(
Uri.parse('$apiAddress/fbla-api/createbusiness'),
body: json,
headers: {'Authorization': token}).timeout(const Duration(seconds: 20));