problem facing while pushing code
See original GitHub issuehi i am using following code snippet to push my code to Cf.
try {
File artefactFile=new File("D:/PROVIDER COCKPIT/DEPLOYING JARS/SpringBootRestApp-0.0.1-SNAPSHOT.jar");
File metaDataFile=new File("D:/PROVIDER COCKPIT/DEPLOYING JARS/sample.yml");
YamlConfigDetails ymlBean = new YamlConfigDetails();
Map<String, Object> yamlConfigDetails = ymlBean.getYamlConfigDetails(metaDataFile);
@SuppressWarnings("unchecked")
LinkedHashMap<String, Object> apps = (LinkedHashMap<String, Object>) yamlConfigDetails.get("applications");
Integer memory = Integer.parseInt(apps.get("memory").toString());
Integer instances = Integer.parseInt(apps.get("instances").toString());
String buildpack = (String) apps.get("buildpack");
String command = null;
String domain = (String) apps.get("domain");
String appName = 12345 + "_" + 12345+ "_" + 0.1;
try {
LOGGER.info("creating application starting:---");
Mono<Void> push = defaultCloudFoundryOperations.applications()
.push(PushApplicationRequest.builder().
name(appName).
path(artefactFile.toPath()).
memory(memory).
command(command).
domain(domain).
buildpack(buildpack).
instances(instances).
randomRoute(true).
noRoute(false).
noStart(false).
build());
LOGGER.info("creating application completed:---");
push.doOnSuccess(x -> System.out.println("deployed succesfully !!")).subscribe();
push.doOnError(x -> System.out.println("deployment failed !!")).subscribe();
LOGGER.info("pushing application completed:---");
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
} catch (Exception e1) {
LOGGER.error(e1.getMessage());
}
i am using this service in my controller. when i invoke that endpoint. it is JUST creating application in CF.
but there is no route binded to application & application is always in stop condititon.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to Fix 'failed to push some refs to' Git Errors - Komodor
It occurs when a developer attempts to push committed code to an external git repository. The ability to push code stopped working suddenly,...
Read more >How to solve git push error while pushing to temp_branch on ...
I am working on the team project on GitHub. I am facing the error : Updates were rejected because a pushed branch tip...
Read more >Error: failed to push some refs to – How to Fix in Git
This error mainly occurs when you attempt to push your local changes to GitHub while the local repository (repo) has not yet been...
Read more >GIT : Resolving " Code push Rejected " - YouTube
GIT is most used code repository. Problem Statement :Sometimes, we forget to pull before Push. In such scenario, if commit has been done...
Read more >Git Error | GitHub Error: failed to push some refs to '[REPO URL]'
... Git/GitHub and just came across the message "failed to push some refs to ..."?Don't worry, this video shows the cause of this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looking over your code there are a couple of areas for improvement that will push your application properly.
There is no need for you to parse your manifest directly. The project provides both the tools and the APIs for using a reference to a manifest directly.
.subscribe()
-ing twice to a reactive flow causes the flow to be triggered twice. Therefore, in your code, you’re telling the application to push twice in close succession leading to one (but which one is undefined) to fail.The entire API is asynchronous and non-blocking. Therefore, once you’ve subscribed to your flow, control is returned to the calling method which promptly completes, before even the first response (
push
is an orchestration of ~13 network requests) has returned. Therefore, your application has completed before the flow has completed. Some environments like Servlet containers have a long enough lifecycle that even if your calling method returns, the execution can still complete before the container closes. If you are running your application in an environment where the method lifecycle is dictates the application lifecycle, you’ll need to ensure that your method is kept alive until the flow is complete.An example of improving all of these issues would be as follows:
@nebhale how to replace System.out::println with logger. in .subscribe(System.out::println, t -> latch.countDown(), latch::countDown);