Skip to content

Commit

Permalink
refactor(jenkins-file): 🎉 add jenkins-file for amazon
Browse files Browse the repository at this point in the history
  • Loading branch information
gokhangunduz committed Aug 28, 2023
1 parent 5282743 commit 513294b
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 3 deletions.
94 changes: 94 additions & 0 deletions Jenkinsfile-namespace-onpremise-amazon
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
metadata:
name: kube-pod
spec:
containers:
- name: docker
image: docker:latest
imagePullPolicy: Always
command:
- cat
tty: true
securityContext:
privileged: true
runAsUser: 0
volumeMounts:
- mountPath: /var/run/docker.sock
name: docker-sock
- name: ubuntu
image: robolaunchio/build-image:1.0
imagePullPolicy: Always
command:
- cat
tty: true
env:
- name: CI
value: false
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
'''
}
}
stages {
stage('Install Deps') {
steps {
container('ubuntu') {
sh 'npm install -g n'
sh 'n latest'
}
}
}
stage('Clone') {
steps {
container('ubuntu') {
git branch: 'main', credentialsId: '7322b7d8-a45e-4594-9bd8-fa1952a7aaad', url: 'git@github.com:robolaunch/ui.git'
sh """export VER=`grep '"version":' package.json | awk '{print \$2}' | sed 's/"//g' | sed 's/,//'` && echo \$VER > version.txt"""
script {
env.VER = readFile('version.txt').trim()
}
}
}
}
stage('Build') {
steps {
container('ubuntu') {
withCredentials([file(credentialsId: 'frontend-namespace-onpremise-amazon-env', variable: 'text')]) {
writeFile file:'./.env', text: readFile(text)
}
sh 'npm i --force'
sh 'npm run build'
sh "tar -zcvf ui-${env.VER}-${env.BUILD_NUMBER}.tar.gz build"
withCredentials([usernamePassword(credentialsId: '7fadeb6b-976b-40ed-8c7c-20e157b4f81a', passwordVariable: 'password', usernameVariable: 'username')]) {
sh "curl --fail -u $username:$password --upload-file ui-${env.VER}-${env.BUILD_NUMBER}.tar.gz https://nexus.robolaunch.cloud/repository/ui/"
}
}
}
}
stage('Docker Build') {
steps {
container('docker') {
sh "docker build -t robolaunchio/ui-namespace-onpremise-amazon-httpd:${env.VER} ."
withCredentials([usernamePassword(credentialsId: 'dockerhub-robolaunchio', passwordVariable: 'password', usernameVariable: 'username')]) {
sh 'docker login -u $username -p $password'
}
sh "docker push robolaunchio/ui-namespace-onpremise-amazon-httpd:${env.VER}"
}
}
}
}
post {
always {
emailext to: "tamer@robolaunch.cloud",
subject: "Jenkins Build ${currentBuild.currentResult}: Job ${env.JOB_NAME}",
body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}",
attachmentsPattern: '*.html'
}
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<img src="https://img.shields.io/badge/nodejs-18.15.0-dgreen" alt="node">
</a>
<a href="https://github.com/robolaunch/ui/releases">
<img src="https://img.shields.io/badge/release-v0.13.9-red" alt="release">
<img src="https://img.shields.io/badge/release-v0.14.0-red" alt="release">
</a>
<a href="#">
<img src="https://img.shields.io/badge/language-typescript-blue" alt="language">
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui",
"version": "0.13.9",
"version": "0.14.0",
"private": true,
"dependencies": {
"@emotion/css": "^11.10.6",
Expand Down
2 changes: 1 addition & 1 deletion src/components/RosConnector/RosConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default function RosConnector(): ReactElement {
isSettedCookie &&
responseRobot?.bridgeIngressEndpoint?.split(":")[0] === "wss"
) {
const ros = new ROSLIB.Ros({
const ros: ROSLIB.Ros = new ROSLIB.Ros({
url: urls?.ros || responseRobot?.bridgeIngressEndpoint,
});

Expand Down

0 comments on commit 513294b

Please sign in to comment.