-
Notifications
You must be signed in to change notification settings - Fork 62
Snapshot for standalone planner UI #2426
Changes from 22 commits
81c2076
c2ecced
4fe072e
81b5cd4
c4c83cc
c1fda0c
8fc8d3f
f4f818c
7aeebd0
80575e1
8d3e25a
388d655
a282f3b
e1c90ef
86a1d7c
3132ef2
f850964
0be09ea
c13e215
cc76762
fc910c6
932fb6f
e2348f6
030cc2e
cbfdc5a
c5da551
9c38eb7
1131f68
f7a21f2
0ae5da9
caa661c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
node_modules | ||
*~ | ||
*.swp | ||
runtime/node_modules | ||
fabric8-ui |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM fabric8/fabric8-openshift-nginx:vd83b3a1 | ||
|
||
USER root | ||
|
||
RUN rm -rf /usr/share/nginx/html/ | ||
COPY ./runtime/dist /usr/share/nginx/html | ||
RUN chmod -R 777 /var/lib/nginx/ | ||
RUN chmod -R 777 /usr/share/nginx/html/ | ||
|
||
|
||
USER ${FABRIC8_USER_NAME} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
@Library('github.com/fabric8io/fabric8-pipeline-library@master') | ||
@Library('github.com/pranavgore09/fabric8-pipeline-library@standalone-planner') | ||
def utils = new io.fabric8.Utils() | ||
def flow = new io.fabric8.Fabric8Commands() | ||
def project = 'fabric8-ui/fabric8-planner' | ||
def ciDeploy = false | ||
def tempVersion | ||
def imageName | ||
def standaloneImageName | ||
node{ | ||
properties([ | ||
disableConcurrentBuilds() | ||
|
@@ -25,15 +26,17 @@ fabric8UITemplate{ | |
container('ui'){ | ||
tempVersion = pipeline.ciBuildDownstreamProject(project) | ||
} | ||
|
||
imageName = "fabric8/fabric8-ui:${tempVersion}" | ||
container('docker'){ | ||
pipeline.buildImage(imageName) | ||
} | ||
|
||
standaloneImageName = "fabric8/fabric8-planner:${tempVersion}" | ||
container('docker'){ | ||
pipeline.getStandaloneImage(standaloneImageName) | ||
} | ||
ciDeploy = true | ||
|
||
|
||
} else if (utils.isCD()){ | ||
sh "git checkout master" | ||
sh "git pull" | ||
|
@@ -69,10 +72,10 @@ fabric8UITemplate{ | |
|
||
// deploy a snapshot fabric8-ui pod and notify pull request of details | ||
if (ciDeploy){ | ||
def prj = 'fabric8-ui-'+ env.BRANCH_NAME | ||
prj = prj.toLowerCase() | ||
def route | ||
timeout(time: 10, unit: 'MINUTES') { | ||
timeout(time: 50, unit: 'MINUTES') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 50 minutes sounds pretty long. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I understand but sometimes even 1h is less,
In best case 10m is sufficient but current builds may take more time and timeout with a small timeout value. |
||
def prj = 'fabric8-ui-'+ env.BRANCH_NAME | ||
prj = prj.toLowerCase() | ||
def route | ||
deployOpenShiftNode(openshiftConfigSecretName: 'fabric8-intcluster-config'){ | ||
stage("deploy ${prj}"){ | ||
route = deployOpenShiftSnapshot{ | ||
|
@@ -99,5 +102,33 @@ if (ciDeploy){ | |
} | ||
} | ||
} | ||
prj = 'f8-plan-std'+ env.BRANCH_NAME | ||
prj = prj.toLowerCase() | ||
deployOpenShiftNode(openshiftConfigSecretName: 'fabric8-intcluster-config'){ | ||
stage("deploy ${prj}"){ | ||
route = deployPlannerSnapshot{ | ||
openShiftProject = prj | ||
openShiftTemplate = 'https://raw.githubusercontent.com/pranavgore09/fabric8-planner/standalone-plannerUI-snapshot/openshift/fabric8-planner.app.yml' | ||
originalImageName = 'fabric8/fabric8-planner' | ||
newImageName = standaloneImageName | ||
githubRepo = 'fabric8-planner' | ||
githubProject = project | ||
} | ||
} | ||
stage("notify for ${prj}"){ | ||
def changeAuthor = env.CHANGE_AUTHOR | ||
if (!changeAuthor){ | ||
error "no commit author found so cannot comment on PR" | ||
} | ||
def pr = env.CHANGE_ID | ||
if (!pr){ | ||
error "no pull request number found so cannot comment on PR" | ||
} | ||
def message = "@${changeAuthor} ${imageName} standalone planner UI is deployed and available for testing at http://${route}" | ||
container('clients'){ | ||
flow.addCommentToPullRequest(message, pr, project) | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,40 @@ def buildImage(imageName){ | |
} | ||
} | ||
|
||
def getStandaloneImage(imageName){ | ||
stage('build standalone npm') { | ||
container('ui'){ | ||
sh ''' | ||
npm install | ||
npm run build | ||
npm pack dist/ | ||
''' | ||
} | ||
dir('runtime'){ | ||
container('ui'){ | ||
sh 'npm cache clean --force' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not required in a fresh environment, unless you have found a reason why it's needed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @debloper I don't think the environment is fresh when we rebuild the PR. At times PR build fails due to npm |
||
sh 'npm install' | ||
sh ''' | ||
export API_URL=https://api.prod-preview.openshift.io/api/ | ||
export FABRIC8_REALM=fabric8-test | ||
export FABRIC8_WIT_API_URL=https://api.prod-preview.openshift.io/api/ | ||
export FABRIC8_SSO_API_URL=https://sso.prod-preview.openshift.io/ | ||
export FABRIC8_AUTH_API_URL=https://auth.prod-preview.openshift.io/api/ | ||
npm run build | ||
''' | ||
} | ||
} | ||
} | ||
|
||
stage('build standalone snapshot image'){ | ||
sh "docker build -t ${imageName} -f ./Dockerfile.deploy.runtime ." | ||
} | ||
|
||
stage('push standalone snapshot image'){ | ||
sh "docker push ${imageName}" | ||
} | ||
} | ||
|
||
def cd (b){ | ||
stage('fix git repo'){ | ||
sh './scripts/fix-git-repo.sh' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
name: f8planner | ||
creationTimestamp: null | ||
objects: | ||
- apiVersion: v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
creationTimestamp: null | ||
generation: 1 | ||
labels: | ||
service: f8planner | ||
app: fabric8-planner | ||
provider: fabric8 | ||
name: f8planner | ||
spec: | ||
replicas: 3 | ||
selector: | ||
service: f8planner | ||
strategy: | ||
resources: {} | ||
rollingParams: | ||
intervalSeconds: 1 | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
timeoutSeconds: 600 | ||
updatePeriodSeconds: 1 | ||
type: Rolling | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
service: f8planner | ||
app: fabric8-planner | ||
provider: fabric8 | ||
spec: | ||
containers: | ||
- image: fabric8/fabric8-planner:standalone | ||
imagePullPolicy: Always | ||
name: f8planner | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
env: | ||
- name: WS_K8S_API_SERVER | ||
value: ${WS_K8S_API_SERVER} | ||
- name: K8S_API_SERVER_PROTOCOL | ||
value: ${K8S_API_SERVER_PROTOCOL} | ||
- name: K8S_API_SERVER_BASE_PATH | ||
value: ${K8S_API_SERVER_BASE_PATH} | ||
- name: OAUTH_ISSUER | ||
value: ${OAUTH_ISSUER} | ||
- name: OAUTH_CLIENT_ID | ||
value: ${OAUTH_CLIENT_ID} | ||
- name: OAUTH_SCOPE | ||
value: ${OAUTH_SCOPE} | ||
- name: OAUTH_AUTHORIZE_URI | ||
value: ${OAUTH_AUTHORIZE_URI} | ||
- name: AUTH_LOGOUT_URI | ||
value: ${AUTH_LOGOUT_URI} | ||
- name: FABRIC8_PIPELINES_NAMESPACE | ||
value: ${FABRIC8_PIPELINES_NAMESPACE} | ||
- name: PROXIED_K8S_API_SERVER | ||
value: ${PROXIED_K8S_API_SERVER} | ||
- name: PROXY_PASS_URL | ||
value: ${PROXY_PASS_URL} | ||
- name: FABRIC8_RECOMMENDER_API_URL | ||
value: ${FABRIC8_RECOMMENDER_API_URL} | ||
- name: FABRIC8_FORGE_API_URL | ||
value: ${FABRIC8_FORGE_API_URL} | ||
- name: OPENSHIFT_CONSOLE_URL | ||
value: ${OPENSHIFT_CONSOLE_URL} | ||
resources: {} | ||
terminationMessagePath: /dev/termination-log | ||
readinessProbe: | ||
tcpSocket: | ||
port: 8080 | ||
initialDelaySeconds: 20 | ||
timeoutSeconds: 10 | ||
livenessProbe: | ||
tcpSocket: | ||
port: 8080 | ||
initialDelaySeconds: 120 | ||
timeoutSeconds: 10 | ||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 | ||
test: false | ||
triggers: | ||
- type: ConfigChange | ||
status: {} | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
service: f8planner | ||
app: fabric8-planner | ||
provider: fabric8 | ||
name: f8planner | ||
spec: | ||
ports: | ||
- name: "8080" | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
service: f8planner | ||
sessionAffinity: None | ||
type: ClusterIP | ||
status: | ||
loadBalancer: {} | ||
- apiVersion: v1 | ||
kind: Route | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
service: f8planner | ||
app: fabric8-planner | ||
provider: fabric8 | ||
name: fabric8-planner | ||
spec: | ||
host: '' | ||
port: | ||
targetPort: "8080" | ||
to: | ||
kind: Service | ||
name: f8planner | ||
weight: 100 | ||
wildcardPolicy: None | ||
status: {} | ||
parameters: | ||
- name: WS_K8S_API_SERVER | ||
value: api.free-int.openshift.com:443 | ||
- name: K8S_API_SERVER_PROTOCOL | ||
value: https | ||
- name: K8S_API_SERVER_BASE_PATH | ||
value: /_p/oso | ||
- name: OAUTH_ISSUER | ||
value: https://api.free-int.openshift.com:443 | ||
- name: OAUTH_CLIENT_ID | ||
value: fabric8 | ||
- name: OAUTH_SCOPE | ||
value: user:full | ||
- name: OAUTH_AUTHORIZE_URI | ||
value: https://api.free-int.openshift.com:443/oauth/authorize | ||
- name: AUTH_LOGOUT_URI | ||
value: https://api.free-int.openshift.com:443/connect/endsession?id_token={{id_token}} | ||
- name: FABRIC8_PIPELINES_NAMESPACE | ||
- name: PROXY_PASS_URL | ||
value: https://api.free-int.openshift.com:443 | ||
- name: OPENSHIFT_CONSOLE_URL | ||
value: https://console.free-int.openshift.com/console/ | ||
- name: PROXIED_K8S_API_SERVER | ||
value: api.free-int.openshift.com:443 | ||
- name: FABRIC8_RECOMMENDER_API_URL | ||
value: https://api-bayesian.dev.rdu2c.fabric8.io/api/v1/ | ||
- name: FABRIC8_FORGE_API_URL | ||
value: https://forge.api.prod-preview.openshift.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're using some custom code, send PR to main repo and switch the DIFF back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done fabric8io/fabric8-pipeline-library#378