-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/YSTV/creator-studio
- Loading branch information
Showing
13 changed files
with
141 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,78 @@ | ||
pipeline { | ||
agent any | ||
|
||
stages { | ||
stage('Install Dependencies') { | ||
steps { | ||
sh 'yarn --no-progress --non-interactive --skip-integrity-check --frozen-lockfile install' | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
sh 'yarn run build' | ||
stages { | ||
stage('Staging') { | ||
when { | ||
branch 'master' | ||
not { | ||
expression { return env.TAG_NAME ==~ /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/ } // Checking if it is main semantic version release | ||
} | ||
} | ||
environment { | ||
APP_ENV = credentials('creator-staging-env') | ||
} | ||
steps { | ||
sh 'cp $APP_ENV .env' | ||
sh 'yarn run build' | ||
sh 'rm .env' | ||
} | ||
} | ||
stage('Production') { | ||
when { | ||
expression { return env.TAG_NAME ==~ /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/ } // Checking if it is main semantic version release | ||
} | ||
environment { | ||
APP_ENV = credentials('creator-prod-env') | ||
} | ||
steps { | ||
sh 'cp $APP_ENV .env' | ||
sh 'yarn run build' | ||
sh 'rm .env' | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Deploy') { | ||
steps { | ||
sshagent(credentials: ['web']) { | ||
sh 'rsync -av --delete-after build deploy@web:/data/webs/creator-studio' | ||
stages { | ||
stage('Staging') { | ||
when { | ||
branch 'master' | ||
not { | ||
expression { return env.TAG_NAME ==~ /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/ } // Checking if it is main semantic version release | ||
} | ||
} | ||
environment { | ||
TARGET_SERVER = credentials('staging-server-address') | ||
TARGET_PATH = credentials('staging-server-path') | ||
} | ||
steps { | ||
sshagent(credentials: ['staging-server-key']) { | ||
sh 'rsync -av --delete-after build deploy@$TARGET_SERVER:$TARGET_PATH/creator-studio' | ||
} | ||
} | ||
} | ||
stage('Production') { | ||
when { | ||
expression { return env.TAG_NAME ==~ /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/ } // Checking if it is main semantic version release | ||
} | ||
environment { | ||
TARGET_SERVER = credentials('prod-server-address') | ||
TARGET_PATH = credentials('prod-server-path') | ||
} | ||
steps { | ||
sshagent(credentials: ['prod-server-key']) { | ||
sh 'rsync -av --delete-after build deploy@$TARGET_SERVER:$TARGET_PATH/creator-studio' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// pipeline { | ||
// agent any | ||
|
||
// stages { | ||
// stage('Update Components') { | ||
// when { | ||
// anyOf { | ||
// branch 'master' | ||
// } | ||
// } | ||
// steps { | ||
// echo "Updating" | ||
// sh "docker pull nginx:stable-alpine" | ||
// sh "docker pull node:alpine" | ||
// } | ||
// } | ||
// stage('Build') { | ||
// when { | ||
// anyOf { | ||
// branch 'master' | ||
// } | ||
// } | ||
// steps { | ||
// echo "Building" | ||
// sh "docker build --build-arg BUILD_ID=${env.BUILD_ID} ." | ||
// } | ||
// } | ||
// stage('Cleanup') { | ||
// when { | ||
// anyOf { | ||
// branch 'master' | ||
// } | ||
// } | ||
// steps { | ||
// echo "Uploading To Registry" | ||
// sh "docker push localhost:5000/ystv/creator-studio:$BUILD_ID" // Uploaded to registry | ||
// echo "Performing Cleanup" | ||
// script { | ||
// try { | ||
// sh "docker image prune -f --filter label=site=creator-studio --filter label=stage=builder --filter label=build=\$((${env.BUILD_NUMBER} - 1))" // Removing the previous local builder image | ||
// } | ||
// catch (err) { | ||
// echo "Couldn't find old build to delete" | ||
// echo err.getMessage() | ||
// } | ||
// } | ||
// sh "docker image rm localhost:5000/ystv/creator-studio:$BUILD_ID" // Removing the local builder image | ||
// } | ||
// } | ||
// stage('Deploy') { | ||
// when { | ||
// anyOf { | ||
// branch 'master' | ||
// } | ||
// } | ||
// steps { | ||
// echo "Deploying" | ||
// sh "docker pull localhost:5000/ystv/creator-studio:$BUILD_ID" // Pulling image from local registry | ||
// script { | ||
// try { | ||
// sh "docker kill ystv-creator-studio" // Stop old container | ||
// } | ||
// catch (err) { | ||
// echo "Couldn't find container to stop" | ||
// echo err.getMessage() | ||
// } | ||
// } | ||
// sh "docker run -d --rm -p 8050:80 --name ystv-creator-studio localhost:5000/ystv/creator-studio:$BUILD_ID" // Deploying site | ||
// sh 'docker image prune -a -f --filter "label=site=creator-studio" --filter "label=stage=final"' // remove old image | ||
// } | ||
// } | ||
// } | ||
// post { | ||
// success { | ||
// echo 'Very cash-money' | ||
// } | ||
// failure { | ||
// echo 'That is not ideal' | ||
// } | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: "3" | ||
services: | ||
creator: | ||
build: | ||
dockerfile: Dockerfile | ||
context: . | ||
environment: | ||
- REACT_APP_API_BASEURL | ||
- REACT_APP_SECURITY_TYPE | ||
- REACT_APP_SECURITY_ENDPOINT | ||
- REACT_APP_UPLOAD_ENDPOINT | ||
- REACT_APP_TITLE | ||
ports: | ||
- "8080:80" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import axios, { AxiosResponse } from "axios"; | ||
|
||
const instance = axios.create({ | ||
baseURL: process.env.REACT_APP_SECURITY_BASEURL, | ||
withCredentials: true | ||
}) | ||
|
||
const resBody = (res: AxiosResponse) => res.data; | ||
|
||
const reqs = { | ||
get: (path: string) => instance.get(path).then(resBody), | ||
post: (path: string, body: {}) => instance.post(path, body).then(resBody), | ||
put: (path: string, body: {}) => instance.put(path, body).then(resBody), | ||
delete: (path: string) => instance.delete(path).then(resBody), | ||
} | ||
|
||
export const Token = { | ||
getToken: () => reqs.get("/api/set_token"), | ||
testToken: () => reqs.get("/api/test"), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.