CF push works nicely, automated deploy fails on Bluemix - jenkins

I have a Java maven project that i deploy to Bluemix using cf push. Works like a charm. It has this manifest:
applications:
- services:
- Monitoring and Analytics-gm
- somedb
disk_quota: 1024M
hosts:
- someapp
name: someapp
path: target/someapp-0.0.2.war
domain: mybluemix.net
instances: 1
memory: 512M
However when I push my repository to hub.jazz.net and kick off build and deploy, the deploy step fails. I checked the artifacts in the build step and the war file got created.
The error message is:
Server error, status code: 400, error code: 170004, message: App staging failed in the buildpack compile phase
What do I miss?
Update
The last lines from the successful build script:
[INFO] Packaging webapp
[INFO] Assembling webapp [someapp] in [/home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/0d82aa76-8fb2-463b-b1d6-6ec80a763706/target/someapp-0.0.2]
[INFO] Processing war project
[INFO] Copying webapp resources [/home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/0d82aa76-8fb2-463b-b1d6-6ec80a763706/src/main/webapp]
[INFO] Webapp assembled in [56 msecs]
[INFO] Building war: /home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/0d82aa76-8fb2-463b-b1d6-6ec80a763706/target/someapp-0.0.2.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.424 s
[INFO] Finished at: 2015-09-15T10:59:52+00:00
[INFO] Final Memory: 17M/27M
[INFO] ------------------------------------------------------------------------
Uploading artifacts ...
UPLOAD SUCCESSFUL
Total time: 2 seconds
Finished: SUCCESS
As you can see the target/someapp-0.0.2.war is build which is the one referred to in the deploy script
The last lines from the failed deploy script
cf --version
/usr/bin/cf-orig/cf version 6.7.0-IDS-2014-12-04T10:56:46+00:00
+ echo 'Target: https://api.ng.bluemix.net'
Target: https://api.ng.bluemix.net
+ source _deploy.sh
++ cf push someapp
Updating app someapp in org someuser#ibm.com / space somespace as someuser#ibm.com...
OK
Uploading someapp...
Uploading app files from: /home/jenkins/workspace/8c791c21-d195-9b03-f3ab-1c2cb5a8a9b4/7c0cd4a8-8ecf-4020-ae82-fc567dd666e9
Uploading 1.9M, 37 files
Done uploading
OK
Stopping app app someapp in org someuser#ibm.com / space somespace as someuser#ibm.com...
OK
Starting app someapp in org someuser#ibm.com / space somespace as someuser#ibm.com...
-----> Downloaded app package (3.9M)
-----> Downloaded app buildpack cache (4.0K)
FAILED
Server error, status code: 400, error code: 170004, message: App staging failed in the buildpack compile phase
TIP: use 'cf logs someapp --recent' for more information
Build step 'Execute shell' marked build as failure
Finished: FAILURE
log from cf logs someapp --recent
2015-09-15T22:53:49.75+0800 [API/5] OUT Updated app with guid 0ac55e94-12b6-490c-99a9-22dfd96ef293 ({"name"=>"someapp"})
2015-09-15T22:54:06.06+0800 [API/5] OUT Updated app with guid 0ac55e94-12b6-490c-99a9-22dfd96ef293 ({"state"=>"STOPPED"})
2015-09-15T22:54:09.68+0800 [DEA/3] OUT Got staging request for app with id 0ac55e94-12b6-490c-99a9-22dfd96ef293
2015-09-15T22:54:15.04+0800 [API/6] OUT Updated app with guid 0ac55e94-12b6-490c-99a9-22dfd96ef293 ({"state"=>"STARTED"})
2015-09-15T22:54:15.22+0800 [STG/3] OUT -----> Downloaded app package (3.9M)
2015-09-15T22:54:15.40+0800 [STG/3] OUT -----> Downloaded app buildpack cache (4.0K)
2015-09-15T22:54:15.84+0800 [STG/0] OUT -----> Liberty Buildpack Version: v1.22-20150824-1104
2015-09-15T22:54:15.84+0800 [STG/0] ERR E, [2015-09-15T14:54:15.846523 #56] ERROR -- /var/vcap/data/dea_next/admin_buildpacks/b1841a6c-5f84-4c40-ac86-9f4d5e8f0643_e788f7b61c5fadd2fec138a1417cd3e1d345df32/lib/liberty_buildpack/buildpack.rb:50:in `rescue in drive_buildpack_with_logger': Compile failed with exception #<RuntimeError: No supported application type was detected>
2015-09-15T22:54:15.84+0800 [STG/0] ERR No supported application type was detected
2015-09-15T22:54:15.85+0800 [STG/0] OUT Staging failed: Buildpack compilation step failed
2015-09-15T22:54:16.70+0800 [API/6] ERR encountered error: App staging failed in the buildpack compile phase
I tried:
no path: in manifest.yml
path: target/someapp-0.0.2.war (that works on local cf push)
path: someapp-0.0.2.war
None of them worked

Aaarrgghh..... 5 hours of my life gone.
I deleted the project and recreated it. When checking the Build Archive Directory it had the entry target (seems to get added when you select mvn). Despite the fact that I tried with path: someapp-0.0.2.war, that didn't work.
Only after removing target and setting path: target/someapp-0.0.2.war the now clean project did build.
So lesson learned: When switching to a mvn build, remove the target from the Build Archive Directory

Yeah usually the error you got means if wasn't able to find the source for your app or the source for the app is wrong... You could also try adding the following line to manifest.yml.
buildpack: liberty-for-java
Your new manifest would be.
applications:
- services:
- Monitoring and Analytics-gm
- somedb
disk_quota: 1024M
hosts:
- someapp
name: someapp
path: target/someapp-0.0.2.war
buildpack: liberty-for-java
domain: mybluemix.net
instances: 1
memory: 512M

Related

Bitbucket pipeline - error installing pre-commit ts-lint

I have a step in my pipeline that runs our configured pre-commit on Bitbucket:
...
- step:
name: Passing linters
image: python:3.7-slim-stretch
script:
- pip3 install "pre-commit==2.17.0"
- apt-get update && apt-get --assume-yes install git
- pre-commit run --all-files
No changes were made but it suddenly stopped working.
The pipeline result:
+ pre-commit run --all-files
[INFO] Initializing environment for https://github.com/psf/black.
[INFO] Initializing environment for https://github.com/psf/black:click==8.0.4.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/maximevast/pre-commit-tslint/.
[INFO] Initializing environment for https://github.com/maximevast/pre-commit-tslint/:tslint-react#4.1.0,tslint#5.20.1,typescript#4.0.2.
[INFO] Installing environment for https://github.com/psf/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/maximevast/pre-commit-tslint/.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/root/.cache/pre-commit/repo1234/node_env-default/bin/node', '/root/.cache/pre-commit/repo1234/node_env-default/bin/npm', 'install', '--dev', '--prod', '--ignore-prepublish', '--no-progress', '--no-save')
return code: 1
expected return code: 0
stdout: (none)
stderr:
/root/.cache/pre-commit/repo1234/node_env-default/bin/node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /root/.cache/pre-commit/repo1234/node_env-default/bin/node)
/root/.cache/pre-commit/repo1234/node_env-default/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /root/.cache/pre-commit/repo1234/node_env-default/bin/node)
/root/.cache/pre-commit/repo1234/node_env-default/bin/node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /root/.cache/pre-commit/repo1234/node_env-default/bin/node)
Check the log at /root/.cache/pre-commit/pre-commit.log
pre-commit utilizes nodeenv to bootstrap node environments
it does this by downloading a copy of node and provisioning an environment (when node is not available). a few days ago node 18.x was released and the prebuilt binaries require a relatively-recent version of glibc
there's a few ways you can work around this:
1. select a specific version of node using language_version / default_language_version
# using default_language_version
default_language_version:
node: 16.14.2
# on the hook itself
repos:
- repo: https://github.com/maximevast/pre-commit-tslint
rev: ...
hooks:
- id: tslint
language_version: 16.14.2
2. use a newer base image
stretch is a bit old, perhaps try instead 3.7-slim-buster instead ?
this will get you a more modern version of glibc
image: python:3.7-slim-buster
3. install node into your image
this will skip the "download node" step of pre-commit by default (specifically it'll default to language_version: system when a suitable node is detected)
this will vary based on your image setup
disclaimer: I created pre-commit

Syndesis build error: Cannot access cluster for detecting mode

When trying to build syndesis I got this error that prevents me to build the images:
[INFO] --- fabric8-maven-plugin:3.5.38:build (build) # meta ---
[INFO] F8: Using OpenShift build with strategy S2I
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[INFO] F8: Running generator spring-boot
[INFO] F8: spring-boot: Using Docker image fabric8/s2i-java:2.1 as base / builder
[WARNING] F8: Cannot access cluster for detecting mode: Failure executing: GET at: https://192.168.42.178:8443/. Message: Unauthorized! Token may have expired! Please log-in again. Unauthorized.
[ERROR] F8: Failed to execute the build [io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to
io.fabric8.openshift.client.OpenShiftClient]
...
[ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:3.5.38:build (build) on project meta: Failed to execute the build: io.fabric8.kubernetes.client.DefaultKubernetesClient cannot be cast to io.fabric8.openshift.client.OpenShiftClient -> [Help 1]
...
Command used to build syndesis: syndesis build -i -f --clean-cache -c
This is because you are logged out from the "oc" command. If you try to use it you will get errors like this one:
$ oc get pods
error: the server doesn't have a resource type "pods"
To fix it, you have to login again:
$ oc login
Authentication required for https://192.168.42.178:8443 (openshift)
Username: developer
Password:
Login successful.
You have access to the following projects and can switch between them with 'oc project <projectname>':
myproject
* syndesis
Using project "syndesis".
If command "oc" is not recognized, you have to setup the environment first:
$ eval $(minishift oc-env)

How to fix ' Error: Invalid or corrupt jarfile /root/.sbt/launchers/1.2.8/sbt-launch.jar'

I was following the tutorial Apache PredictionIO Docker.When I was the step "Build Template"
# pio-docker build --verbose
It went an error.
[root#docker01 MyRecommendation]# pio-docker build --verbose
[INFO] [Engine$] Using command '/usr/share/predictionio/sbt/sbt' at /templates/MyRecommendation to build.
[INFO] [Engine$] If the path above is incorrect, this process will fail.
[INFO] [Engine$] Uber JAR disabled. Making sure lib/pio-assembly-0.13.0.jar is absent.
[INFO] [Engine$] Going to run: /usr/share/predictionio/sbt/sbt package assemblyPackageDependency in /templates/MyRecommendation
[ERROR] [Engine$] Error: Invalid or corrupt jarfile /root/.sbt/launchers/1.2.8/sbt-launch.jar
[ERROR] [Engine$] Return code of build command: /usr/share/predictionio/sbt/sbt package assemblyPackageDependency is 1. Aborting.
[root#docker01 MyRecommendation]#
1.I've made the dirs
/templates/MyRecommendation
,I don't know some how why the command
pio-docker
,always need that dirs,nor the next dirs
templates/MyRecommendation
.My current dirs is
/root/predictionio/docker/templates/MyRecommendation
to execute the command
# pio-docker build --verbose
2.
/usr/share/predictionio/sbt/sbt
That file do not exists,before I made a softlinks to it.now if I execute it ,it works fine.In the original tutorial
Installing with Docker
,it didn't tell you to do it .
You must remove .sbt folder so fixed this error.

How to filter files in sonar SCM?

I have installed a CI environment for my PHP project.
I use jenkins + sonar + Gitlab.
All things seem great until build a jenkins job.
The error info is
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 2:03.218s
Final Memory: 345M/456M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Unable to blame file src/apps/conf.php. No blame info at line 1. Is file commited?
10:21:17.165 INFO - Author: PersonIdent[Not Committed Yet, , Wed Feb 4 10:21:17 2015 +0800]
ERROR:
I find sonar SCM-Activity-Plugin report this bug.
The conf.php file is my config file and can not push to Gitlab.
So, Is there a way to ask SCM-Activity-Plugin filter these config files?
thanks a lot!
Excluding the file from sonar analysis might help.
Login to sonar using admin or user that have got administrative rights in the project.
Open the project and select “Settings” from “Project Configuration”.
There click on “Exclusions” link and take “File” tab.
Under “Source File Exclusions” give your file as src/apps/conf.php

Sonar runner Execution failure on Jenkins

I am trying to configure a Sonar Plugin on Jenkins, Executing this SonarJob on jenkins results in an error. The output console does not indicate whats causing this error. Looking for a way to debug this issue.
-Some info on the Setup
->The SonarJob workspace is copied from another Job
-> configured Sonar and Sonar Runner in Jenkins-> Configure System
-> Sonar Build Step is Triggered by "invoke Standalone Sonar Analysis" . The output console log is as follows
Thanks In Advance !
Lokesh
Started by user cheetahb#ca.ibm.com
[EnvInject] - Loading node environment variables.
Building on master in workspace /drv-cheetbld3_1/pipeline/jenkins/jobs/SonarQube1/workspace
Copied 2,820 artifacts from "BI-Pattern_3.0_build" build number 41
[workspace] $ /home/cheetahb/sonarhome/bin/sonar-runner Sonar_5.0_new -Dsonar.jdbc.driver=com.mysql.jdbc.Driver -Dsonar.jdbc.url=jdbc:mysql://9.37.213.8:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance ******** ******** -Dsonar.host.url=http:// vottlokesh. ottawa.ibm.com:9000/ -Dsonar.projectBaseDir=/drv-cheetbld3_1/pipeline/jenkins/jobs/SonarQube1/workspace -Dsonar.projectName=biPattern3.0 -Dsonar.projectVersion=1.0 -Dsonar.projectKey=biproject -Dsonar.verbose=true -Dsonar.sources=/drv-cheetbld3_1/pipeline/jenkins/jobs/SonarQube1/workspace
SonarQube Runner 2.4
Java 1.7.0_65 Oracle Corporation (64-bit)
Linux 2.6.32-431.20.5.el6.x86_64 amd64
INFO: Runner configuration file: /home/cheetahb/sonarhome/conf/sonar-runner.properties
INFO: Project configuration file: NONE
INFO: SonarQube Server 5.0
18:23:43.161 INFO - Load global referentials...
18:23:43.181 DEBUG - Download: http:// vottlokesh.ottawa.ibm.com:9000/batch/global (no proxy)
18:23:43.926 INFO - Load global referentials done: 768 ms
18:23:43.932 INFO - User cache: /home/cheetahb/.sonar/cache
18:23:43.947 INFO - Install plugins
18:23:43.947 DEBUG - Download index of plugins
18:23:43.947 DEBUG - Download: http:// vottlokesh.ottawa.ibm.com:9000/deploy/plugins/index.txt (no proxy)
18:23:44.066 INFO - Install JDBC driver
18:23:44.066 DEBUG - Download index of jdbc-driver
18:23:44.067 DEBUG - Download: http:// vottlokesh.ottawa.ibm.com:9000/deploy/jdbc-driver.txt (no proxy)
18:23:44.079 INFO - Create JDBC datasource for jdbc:mysql://9.37.213.8:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
18:23:45.834 DEBUG - Testing JDBC connection
18:23:48.209 DEBUG - Download: http:// vottlokesh.ottawa.ibm.com:9000/api/server (no proxy)
18:23:48.523 INFO - Initializing Hibernate
18:23:48.526 DEBUG - hibernate.generate_statistics: false
18:23:48.527 DEBUG - hibernate.dialect: org.sonar.core.persistence.dialect.MySql$MySqlWithDecimalDialect
18:23:48.527 DEBUG - hibernate.connection.provider_class: org.sonar.jpa.session.CustomHibernateConnectionProvider
18:23:50.751 DEBUG - Loaded 2689 properties from l10n bundles
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 8.801s
Final Memory: 35M/355M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Task Sonar_5.0_new does not exist
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Invoke Standalone Sonar Analysis' marked build as failure
Finished: FAILURE
You must get rid of the Sonar_5.0_new label that you set on the Task to run field in your Jenkins job configuration.

Resources