Bluemix Deploy Behaviors - Declared Services - ibm-cloud

I have the following manifest.yml file for a WAR file deployment to Liberty on Cloud Foundry-based Bluemix. When I use the deploy stage from the pipeline to my own workspace, the declared services and service bindings to the app from my manifest file are ignored. However, when using the Deploy to Bluemix button, the dependent services and bindings are created.
How can I force the deploy stage to create and bind services if they don't exist in the space when NOT using "Deploy to Bluemix" but simply using the deploy stage?
---
declared-services:
tuck-cloudant-cloudantNoSQLDB:
label: cloudantNoSQLDB
plan: Shared
applications:
- services:
- tuck-cloudant-cloudantNoSQLDB
- name: HelloWorldTuck4
path: HelloWorld.war
Thanks!
Jeff

The service bindings in the file manifest.yml are IBM extensions to the Cloud Foundry standard (see the Deploy to Bluemix) which are hopefully incorporated. However, at this time only the special deployment processing of the Deploy to Bluemix button will take care of that declared services section and will provision the services for you.

Indeed you can script the service creation in the pipeline.
There is even a way to make it occur with a Deploy to Bluemix button, using a pipeline.yml file in your sample repo: https://console.ng.bluemix.net/docs/develop/sharetextpipelines.html
See an example there:
https://github.com/hmagph/sample-java-cloudant

The declared services are specific to Deploy to Bluemix. You can, however, run pretty much any cf cli command you want in the deploy stage. You should be able to do a cf create-service ... or a cf bind-service .... This would have to be done manually, adding lines to the deploy script.

Related

Exception calling IAM: There were concurrent policy changes

I get the above error after running mvn -DskipTests package appengine:deploy. Here's the whole error:
Exception calling IAM: There were concurrent policy changes. Please retry the whole read-modify-write with exponential backoff. The request's ETag '\007\005\364\274\033.\262\307' did not match the current policy's ETag '\007\005\364\274\033\177\220\315'.
From my reading, this occurs when there multiple policy changes at the same time. The other questions I've seen throw this error in regard to a POST request but this is to do with an appengine:deploy
What IAM policy does the service account need to work?
This is the IAM account that I believe was created by the appengine:deploy process and it's permissions:
Note - I don't think it's applicable but I added this deploy to appengine step to a Spring Boot app speakiong to a Postgres db.
EDIT
As mentioned in the comment, #Robina's answer has moved me along but not the logs show this error:
UnsupportedClassVersionError: org/springframework/boot/loader/JarLauncher has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtome only recognizes class file version up to 55.0
But setting the java version to 17 throws a build error; here's my appengine.yaml:
runtime: java11
instance_class: F1
EDIT 2
I came across this while reading through the Google guide here which said:
Deploying an executable JAR
Use any build framework to build an executable JAR locally, then do one of the following depending on whether you created an app.yaml file for your app:
If you created an app.yaml file:
Copy the file into the same directory as the executable JAR file you created.
From the directory that contains the app.yaml and your JAR, enter the following command:
gcloud app deploy
gcloud app deploy will create an app.yaml file that contains the
minimum settings, using all default values.
I thought, why not? So I deleted the appengine folder and its app.yaml and then ran the command from above, minus the jar:
gcloud app deploy
After, probably 10 minutes of the command running the app was deployed and points to the Postgres database without any problems. Thanks #Robina for the help!
The service account must have the App Engine Deployer role in order to deploy an application to App Engine. The IAM policy needed for the service account to function depends on what it is used for. Your application is probably being deployed to Google App Engine using the service account if you are using appengine:deploy.
A gcloud command example for granting the role:
gcloud projects add-iam-policy-binding [PROJECT_ID] --member=serviceAccount:[SERVICE_ACCOUNT_EMAIL] --role=roles/appengine.deployer
[PROJECT ID] and [SERVICE ACCOUNT EMAIL] should be changed to reflect your project ID and service account email, respectively.

Cloud Functions Deployment Issue (.Net 6)

This is the first time I'm working on Google Cloud Functions. I've created a http trigger cloud function using .Net6 framework and trying to deploy it using gcloud Cli. The deployment was failing, and I know why but don't know how to solve it.
I've couple of cs-projects, Cloud Functions project (CFP), Application Services project (ASP) and DBRepositories project (DBP). CFP has a reference of ASP which then has a reference of DBP. I've initiated the deployment from the directory of where Function1.cs(CFP) located. The deployment was unable to locate the other two projects rereferred to CFP.
Project reference visualization:
CloudFunctions.csproj <- ApplicationServices.csproj <- DBRepositories.csproj
I even initiated the deployment from the directory where solution file is located but failed with error "Too many projects found."
Cli command:
gcloud functions deploy demo-function --entry-point HelloFunction.Function1 --runtime dotnet6 --trigger-http --allow-unauthenticated --gen2 --region us-central1
I'm stuck here, any help greatly appreciated. TIA

IBM Cloud Private - Deploy Node Js application

We have configured IBM Cloud Private 2.1.0.3
We have sample node application. We need to deploy the same in ICP console.
We have followed the procedures listed in the below link.
https://www.ibm.com/support/knowledgecenter/SSBS6K_2.1.0.3/app_center/create_helm_cli.html
Please suggest suitable methods.
to deploy an application, you can deploy using
cli
ICP UI
CLI
using helm chart you created
i have a sample project where I shows a java app how it is package and deploy, hopes it helps
https://github.com/ibmcloudprivate2/wildfly
using deployment file
UI
using helm chart you created and added into the UI catalog and deploy using it
see above .
using deployment and service
the following project, i have package a ng sample and shows how to deploy using the UI Workloads/Deployment/Create Deployment and Network Access/Services/Create Service
https://github.com/ibmcloudprivate2/ng4-admin
hopes it helps.

What happens to a CF manifest after a successful deployment?

I am currently tinkering with Cloud Foundry. I understand the basic principles of the tool but can't find what cf push actually does to a manifest file.
Does it read the file just once or is it stored as a static file with the application?
Also, is it possible to retrieve a manifest from a deployed app?
The cf push command reads the manifest file and uses the attribute values (instances, memory, disk etc) for the current deployment. The manifest helps to automate the app deployment. It can also be used for deploying multiple applications at once. As stated here: https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html, when you deploy an application for the first time, Cloud Foundry reads the variables described in the environment block of the manifest, and adds them to the environment of the container where the application is deployed. When your app is running, your environment variables can change depending on your setting. For example, if you have an auto-scaler, it could have increased/decreased your no. of instances/memory/disk (environment variables). If that is the case, when you stop and then restart an application, its environment variables persist.
The manifest file is read only when the "cf push" command is executed. As stated in the Cloud Foundry Documentation (https://docs.cloudfoundry.org/devguide/deploy-apps/prepare-to-deploy.html#exclude), the manifest file is just read and not actually stored as a file, hence it could not be accessed for a deployed app. However, if the purpose for accessing your manifest is to read your current environment setting, it can be accessed through the Cloud Foundry API's Get App Summary (or) Get detailed stats for a STARTED App: https://apidocs.cloudfoundry.org/234/

Build number not available to running app?

I've got a Liberty Profile app that I am building/deploying with the devops pipeline, and I don't see any mechanism for determining the current build that is running. I've dumped all the environment vars, and nothing appears to indicate the build number.
Is the value someplace I am just not finding or is it really just not available?
Build and Deploy Jobs in Bluemix DevOps Services offer and environment variable called: BUILD_NUMBER. This variable is not propagated automatically to Bluemix runtimes.
Perhaps in the deploy script, you can add a Cloud Foundry environment variable associated to your app. Something like:
cf set-env "${CF_APP}" BUILD_NUMBER "${BUILD_NUMBER}"
so you will have such info accessible from the running code.
Hope it helps!