[👷] Jenkins Test
Some checks reported errors
Stein_Back/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
Stein_Back/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
09ef4b6945
commit
dc62344e15
43
Jenkinsfile
vendored
43
Jenkinsfile
vendored
|
@ -1,10 +1,49 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
environment {
|
||||
DOCKER_CONTAINER_NAME = 'stein-node'
|
||||
APP_VOLUME_FRONT = '/home/node/app' // stein-node 컨테이너 내부 경로
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('stage 1') {
|
||||
stage('Clone Repository') {
|
||||
steps {
|
||||
echo "Hello world"
|
||||
git url: 'https://git.ipstein.myds.me/Team.Stein/Front.git', branch: 'main'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
steps {
|
||||
script {
|
||||
// Docker 컨테이너 ID 가져오기
|
||||
def containerId = sh(script: "docker ps -qf 'name=${DOCKER_CONTAINER_NAME}'", returnStdout: true).trim()
|
||||
if (containerId) {
|
||||
// 컨테이너 내부로 파일 복사
|
||||
sh "docker cp ${WORKSPACE}/. ${containerId}:${APP_VOLUME_FRONT}"
|
||||
// 컨테이너 재시작
|
||||
sh "docker restart ${containerId}"
|
||||
} else {
|
||||
error "Docker container ${DOCKER_CONTAINER_NAME} not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
script {
|
||||
def containerId = sh(script: "docker ps -qf 'name=${DOCKER_CONTAINER_NAME}'", returnStdout: true).trim()
|
||||
if (containerId) {
|
||||
sh "docker logs ${containerId}"
|
||||
} else {
|
||||
echo "Docker container ${DOCKER_CONTAINER_NAME} not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
failure {
|
||||
echo "Build failed. Check the console output for details."
|
||||
}
|
||||
}
|
||||
}
|
431
index.js
431
index.js
|
@ -1,434 +1,3 @@
|
|||
// import express from 'express';
|
||||
// import path from 'path';
|
||||
// import { fileURLToPath } from 'url';
|
||||
// import cors from 'cors';
|
||||
|
||||
|
||||
// const __filename = fileURLToPath(import.meta.url);
|
||||
// const __dirname = path.dirname(__filename);
|
||||
|
||||
// const app = express();
|
||||
// const port = 6007;
|
||||
|
||||
|
||||
// app.use(cors());
|
||||
// app.use(express.json()); // JSON 파서 미들웨어 추가
|
||||
// app.use(express.urlencoded({ extended: true })); // URL-encoded 파서 미들웨어 추가
|
||||
// app.use(express.static(path.join(__dirname, '..', 'front')));
|
||||
|
||||
// app.get('/login', (req, res) => {
|
||||
// res.sendFile(path.join(__dirname, '..', 'front', 'login.html'));
|
||||
// });
|
||||
|
||||
// app.post('/login', async (req, res) => {
|
||||
// const { username, password } = req.body;
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/auth.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.API.Auth',
|
||||
// version: '6',
|
||||
// method: 'login',
|
||||
// account: username,
|
||||
// passwd: password,
|
||||
// session: 'FileStation',
|
||||
// format: 'sid'
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const data = await response.json();
|
||||
|
||||
// if (data.success) {
|
||||
// res.json({ success: true });
|
||||
// } else {
|
||||
// res.json({ success: false });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// app.listen(port, () => {
|
||||
// console.log(`Server is running at http://localhost:${port}`);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// import express from 'express';
|
||||
// import path from 'path';
|
||||
// import { fileURLToPath } from 'url';
|
||||
// import cors from 'cors';
|
||||
// import fetch from 'node-fetch';
|
||||
|
||||
// const __filename = fileURLToPath(import.meta.url);
|
||||
// const __dirname = path.dirname(__filename);
|
||||
|
||||
// const app = express();
|
||||
// const port = 6007;
|
||||
|
||||
// app.use(cors());
|
||||
// app.use(express.json());
|
||||
// app.use(express.urlencoded({ extended: true }));
|
||||
// app.use(express.static(path.join(__dirname, '..', 'front')));
|
||||
|
||||
// let sessionId = ''; // 세션 ID를 저장할 변수
|
||||
|
||||
// app.get('/login', (req, res) => {
|
||||
// res.sendFile(path.join(__dirname, '..', 'front', 'login.html'));
|
||||
// });
|
||||
|
||||
// app.post('/login', async (req, res) => {
|
||||
// const { username, password } = req.body;
|
||||
|
||||
// console.log('로그인 요청 수신:', { username, password });
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/auth.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.API.Auth',
|
||||
// version: '6',
|
||||
// method: 'login',
|
||||
// account: username,
|
||||
// passwd: password,
|
||||
// session: 'FileStation',
|
||||
// format: 'sid'
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const text = await response.text();
|
||||
// console.log('API 응답 수신:', text);
|
||||
|
||||
// const data = JSON.parse(text);
|
||||
// console.log('API 응답 데이터:', data);
|
||||
|
||||
// if (data.success) {
|
||||
// sessionId = data.data.sid; // 세션 ID 저장
|
||||
// res.json({ success: true });
|
||||
// } else {
|
||||
// console.error('로그인 실패:', data);
|
||||
// res.json({ success: false, error: data.error });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.get('/getGroups', async (req, res) => {
|
||||
// const { username } = req.query;
|
||||
|
||||
// console.log('그룹 정보 요청 수신:', { username });
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/entry.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.Core.Group',
|
||||
// version: '1',
|
||||
// method: 'list',
|
||||
// additional: 'members',
|
||||
// _sid: sessionId // 세션 ID 추가
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const text = await response.text();
|
||||
// console.log('그룹 API 응답 수신:', text);
|
||||
|
||||
// const data = JSON.parse(text);
|
||||
// console.log('원본 그룹 데이터:', data); // 원본 데이터 로그 출력
|
||||
|
||||
// if (data.success) {
|
||||
// // group.members가 정의되어 있는지 확인 후 필터링
|
||||
// const groups = data.data.groups.filter(group => group.members && group.members.includes(username));
|
||||
// console.log('필터링된 그룹 정보:', groups); // 필터링된 그룹 정보 로그 출력
|
||||
// res.json(groups);
|
||||
// } else {
|
||||
// console.error('그룹 정보 조회 실패:', data);
|
||||
// res.json({ success: false, error: data.error });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.listen(port, () => {
|
||||
// console.log(`Server is running at http://localhost:${port}`);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// import express from 'express';
|
||||
// import path from 'path';
|
||||
// import { fileURLToPath } from 'url';
|
||||
// import cors from 'cors';
|
||||
// import fetch from 'node-fetch';
|
||||
|
||||
// const __filename = fileURLToPath(import.meta.url);
|
||||
// const __dirname = path.dirname(__filename);
|
||||
|
||||
// const app = express();
|
||||
// const port = 6007;
|
||||
|
||||
// app.use(cors());
|
||||
// app.use(express.json());
|
||||
// app.use(express.urlencoded({ extended: true }));
|
||||
// app.use(express.static(path.join(__dirname, '..', 'front')));
|
||||
|
||||
// let sessionId = ''; // 세션 ID를 저장할 변수
|
||||
|
||||
// app.get('/login', (req, res) => {
|
||||
// res.sendFile(path.join(__dirname, '..', 'front', 'login.html'));
|
||||
// });
|
||||
|
||||
// app.post('/login', async (req, res) => {
|
||||
// const { username, password } = req.body;
|
||||
|
||||
// console.log('로그인 요청 수신:', { username, password });
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/auth.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.API.Auth',
|
||||
// version: '6',
|
||||
// method: 'login',
|
||||
// account: username,
|
||||
// passwd: password,
|
||||
// session: 'FileStation',
|
||||
// format: 'sid'
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const text = await response.text();
|
||||
// console.log('API 응답 수신:', text);
|
||||
|
||||
// const data = JSON.parse(text);
|
||||
// console.log('API 응답 데이터:', data);
|
||||
|
||||
// if (data.success) {
|
||||
// sessionId = data.data.sid; // 세션 ID 저장
|
||||
// res.json({ success: true });
|
||||
// } else {
|
||||
// console.error('로그인 실패:', data);
|
||||
// res.json({ success: false, error: data.error });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.get('/getGroups', async (req, res) => {
|
||||
// const { username } = req.query;
|
||||
|
||||
// console.log('그룹 정보 요청 수신:', { username });
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/entry.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.Core.Group',
|
||||
// version: '1',
|
||||
// method: 'list',
|
||||
// additional: 'members',
|
||||
// _sid: sessionId // 세션 ID 추가
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const text = await response.text();
|
||||
// console.log('그룹 API 응답 수신:', text);
|
||||
|
||||
// const data = JSON.parse(text);
|
||||
// console.log('원본 그룹 데이터:', data); // 원본 데이터 로그 출력
|
||||
|
||||
// if (data.success) {
|
||||
// res.json(data.data.groups); // 필터링 없이 원본 데이터를 반환
|
||||
// } else {
|
||||
// console.error('그룹 정보 조회 실패:', data);
|
||||
// res.json({ success: false, error: data.error });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.listen(port, () => {
|
||||
// console.log(`Server is running at http://localhost:${port}`);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// import express from 'express';
|
||||
// import path from 'path';
|
||||
// import { fileURLToPath } from 'url';
|
||||
// import cors from 'cors';
|
||||
// import fetch from 'node-fetch';
|
||||
|
||||
// const __filename = fileURLToPath(import.meta.url);
|
||||
// const __dirname = path.dirname(__filename);
|
||||
|
||||
// const app = express();
|
||||
// const port = 6007;
|
||||
|
||||
// app.use(cors());
|
||||
// app.use(express.json());
|
||||
// app.use(express.urlencoded({ extended: true }));
|
||||
// app.use(express.static(path.join(__dirname, '..', 'front')));
|
||||
|
||||
// let sessionId = ''; // 세션 ID를 저장할 변수
|
||||
|
||||
// // 루트 경로로 접속했을 때 다른 도메인으로 리다이렉트
|
||||
// app.get('/', (req, res) => {
|
||||
// res.redirect("https://ipstein.myds.me"); // 원하는 도메인으로 리다이렉트
|
||||
// });
|
||||
|
||||
// app.get('/login', (req, res) => {
|
||||
// res.sendFile(path.join(__dirname, '..', 'front', 'login.html'));
|
||||
// });
|
||||
|
||||
// app.post('/login', async (req, res) => {
|
||||
// const { username, password } = req.body;
|
||||
|
||||
// console.log('로그인 요청 수신:', { username, password });
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/auth.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.API.Auth',
|
||||
// version: '6',
|
||||
// method: 'login',
|
||||
// account: username,
|
||||
// passwd: password,
|
||||
// session: 'FileStation',
|
||||
// format: 'sid'
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const text = await response.text();
|
||||
// console.log('API 응답 수신:', text);
|
||||
|
||||
// const data = JSON.parse(text);
|
||||
// console.log('API 응답 데이터:', data);
|
||||
|
||||
// if (data.success) {
|
||||
// sessionId = data.data.sid; // 세션 ID 저장
|
||||
// res.json({ success: true });
|
||||
// } else {
|
||||
// console.error('로그인 실패:', data);
|
||||
// res.json({ success: false, error: data.error });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.get('/getGroups', async (req, res) => {
|
||||
// const { username } = req.query;
|
||||
|
||||
// console.log('그룹 정보 요청 수신:', { username });
|
||||
|
||||
// const apiUrl = "https://admin.ipstein.myds.me/webapi/entry.cgi";
|
||||
// const params = new URLSearchParams({
|
||||
// api: 'SYNO.Core.Group',
|
||||
// version: '1',
|
||||
// method: 'list',
|
||||
// additional: 'members',
|
||||
// _sid: sessionId // 세션 ID 추가
|
||||
// });
|
||||
|
||||
// try {
|
||||
// const response = await fetch(`${apiUrl}?${params.toString()}`);
|
||||
// const text = await response.text();
|
||||
// console.log('그룹 API 응답 수신:', text);
|
||||
|
||||
// const data = JSON.parse(text);
|
||||
// console.log('원본 그룹 데이터:', data); // 원본 데이터 로그 출력
|
||||
|
||||
// if (data.success) {
|
||||
// res.json(data.data.groups); // 필터링 없이 원본 데이터를 반환
|
||||
// } else {
|
||||
// console.error('그룹 정보 조회 실패:', data);
|
||||
// res.json({ success: false, error: data.error });
|
||||
// }
|
||||
// } catch (error) {
|
||||
// console.error('Error:', error);
|
||||
// res.status(500).json({ success: false });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.get('/admin', (req, res) => {
|
||||
// res.sendFile(path.join(__dirname, '..', 'front', 'admin.html'));
|
||||
// });
|
||||
|
||||
// app.listen(port, () => {
|
||||
// console.log(`Server is running at http://localhost:${port}`);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import express from 'express';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
|
Loading…
Reference in New Issue
Block a user