Coder Social home page Coder Social logo

sap / devops-docker-cf-cli Goto Github PK

View Code? Open in Web Editor NEW
6.0 12.0 13.0 61 KB

Dockerfile for the Cloud Foundry command line client that can be used in Continuous Delivery pipelines for SAP development projects with project "Piper" or any other CD tool.

License: Apache License 2.0

Dockerfile 62.14% Shell 37.86%
open-source

devops-docker-cf-cli's Introduction

Cloud Foundry Command Line Interface (CLI)

REUSE status

This Dockerfile can be used in Continuous Delivery (CD) pipelines for SAP development projects. The image is optimized for use with project "Piper" on Jenkins. Docker containers simplify your CD tool setup, encapsulating tools and environments that are required to execute pipeline steps.

If you want to learn how to use project "Piper" please have a look at the documentation. Introductory material and a lot of SAP scenarios not covered by project "Piper" are described in our Continuous Integration Best Practices.

About this repository

Dockerfile for an image with the Cloud Foundry CLI and plugins for blue-green deployment and Multi-Target Applications (MTA).

Download

This image is published to Docker Hub and can be pulled via the command

docker pull ppiper/cf-cli

Build

To build this image locally, open a terminal in the directory of the Dockerfile and run

docker build -t ppiper/cf-cli .

Usage

Recommended usage of this image is via cloudFoundryDeploy pipeline step.

For using the cf tool via this image, it can be invoked like in this command

docker run ppiper/cf-cli cf --help

Testing

Running as a Service

See .travis.yml file for configuration.

Configure the following variables (secrets)

  • CX_INFRA_IT_CF_USERNAME (user name for deployment to SAP Cloud Platform)
  • CX_INFRA_IT_CF_PASSWORD (password for deployment to SAP Cloud Platform)

Running locally

Docker is required, and at least 4 GB of memory assigned to Docker.

export CX_INFRA_IT_CF_USERNAME="myusername"
export CX_INFRA_IT_CF_PASSWORD="mypassword"
./runTests.sh

Licensing

Copyright 2017-2021 SAP SE or an SAP affiliate company and devops-docker-cf-cli contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.

devops-docker-cf-cli's People

Contributors

1084565 avatar amitnagar01 avatar boyan-velinov avatar fwilhe avatar ivanborislavovdimitrov avatar m-i-p-s avatar misappi avatar o-liver avatar olivernocon avatar radsoulbeard avatar rodibrin avatar sebastianwolf-sap avatar srinikitha09 avatar theghost5800 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devops-docker-cf-cli's Issues

cf deploy fails with error "Operation Not permitted"

In the latest version ppiper/cf-cli:v15, cf Deploy fails with error "Operation Not Permitted" and log messages as shown below

info cloudFoundryDeploy - Use 'cf repo-plugins' to list plugins in registered repos available to install.
info cloudFoundryDeploy - running command: cf deploy ro-bookshop.mtar -f
info cloudFoundryDeploy - runtime/cgo: pthread_create failed: Operation not permitted
info cloudFoundryDeploy - SIGABRT: abort
info cloudFoundryDeploy - PC=0x7fe9b78ccd3c m=0 sigcode=18446744073709551610

But version ppiper/cf-cli:v14, working without any issue.

Invalid JSON content from server: invalid character '<' looking for beginning of value FAILED

Hello Experts

I am trying to connect AzureDevOps Pipelines to HANA XSA system. I am using the reference provided in one of the blogs.

https://blogs.sap.com/2019/10/24/how-to-use-project-piper-docker-images-for-cicd-with-azure-devops/

I noticed that while deploying using cf-cli I get a bash error.

Starting: Bash
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.171.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Script contents:
cf login -u "*******" -p "***" -a "*********" -o "******" -s "******" --skip-ssl-validation
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /__w/_temp/895a84ec-07bb-403d-ae3c-714ec57ca434.sh
API endpoint: https://************

Invalid JSON content from server: invalid character '<' looking for beginning of value
FAILED

##[error]Bash exited with code '1'.
Finishing: Bash

From AzureDevOps helps documents and GitHub issues pages , they have pointed the issue to the containers we are calling.
Any help on this is much appreciated.

PS: I have hidden the URLs by ********

Thanks
Prateek

Add the html5-plugin to this docker image

Hello,

@ncktz filed the issue Push of HTML5 apps to HTML5 App Repo via html5-plugin not possible with Project Piper #1989 quite some time ago. But it seems that the jenkins-library project is the wrong place. So let's try it here at the origin of the cf-cli Docker Image:

Based on SAP's recommendation, we are using the HTML5 App Repository to deploy our SAPUI5 modules. To reduce the amount of required app runtime, we do not use the HTML 5 App Deployer but follow the approach described under https://sap.github.io/cf-html5-apps-repo-cli-plugin/.

Based on our analysis, Project Piper does not seem to offer a possibility to implement this approach without creating own Docker images or using manual scripts. For this reason, we would propose the following:

  1. Add the following line to include the html5-plugin into the Docker image cf-cli, the default image of the CloudFoundryDeploy step:
    cf install-plugin -r CF-Community "html5-plugin"
  2. Add a possibility for a 'RunCommand' parameter in the CloudFoundryDeploy step (same concept as in the Karma Execute step), so you can execute the html-5 push command (e.g): "cf html5-push -n repo-host".

Alternatively, it might also be worth considering to add the push to the HTML5 app repo as a completely new step.

Best Regards
Gregor

CC: @lucasheim, @levinanton

Dial tcp: i/o timeout when accessing CF API endpoint

Hi,

I'm using this Docker container as part of project piper, however I'm not able to establish the connection to the CF API endpoint. There is no proxy necessary in my network and the connection works fine for all other steps/containers.

--- Begin library step of: dockerExecute ---
[Pipeline] timeout
Timeout set to expire in 10 sec
[Pipeline] {
[Pipeline] httpRequest

[Pipeline] }
[Pipeline] // timeout
[Pipeline] sh
+ docker ps -q
[Pipeline] isUnix
[Pipeline] sh
+ docker pull ppiper/cf-cli
Using default tag: latest

latest: Pulling from ppiper/cf-cli
Digest: sha256:4dadef1d961a1805db2b1c2d11832229962d6268e06d692a68818c5451a796ab
Status: Image is up to date for ppiper/cf-cli:latest
[Pipeline] isUnix
[Pipeline] sh
+ docker inspect -f . ppiper/cf-cli
.
[Pipeline] withDockerContainer
Jenkins seems to be running inside container 1fcdc6b6c8c2015dd746f66f714a65548e23363ca78af50b94e48d46ff2e1a2a
$ docker run -t -d -u 1000:1001 --env http_proxy --env https_proxy --env no_proxy --env HTTP_PROXY --env HTTPS_PROXY --env NO_PROXY -w /var/jenkins_home/workspace/QA --volumes-from 1fcdc6b6c8c2015dd746f66f714a65548e23363ca78af50b94e48d46ff2e1a2a -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** ppiper/cf-cli cat
$ docker top 680e99db9086cd3712ccf972d377a8d97791e868a6fce1342cd8fba6a14a3ab6 -eo pid,comm
[Pipeline] {
[Pipeline] echo
[cloudFoundryDeploy] Deploying MTA (appLibrary.mtar) with following parameters:  -f --no-confirm
[Pipeline] withCredentials
Masking supported pattern matches of $username or $password
[Pipeline] {
[Pipeline] sh

**Setting api endpoint to https://api.cf.eu10.hana.ondemand.com...

Request error: Get https://api.cf.eu10.hana.ondemand.com/v2/info: dial tcp: i/o timeout**
TIP: If you are behind a firewall and require an HTTP proxy, verify the https_proxy environment variable is correctly set. Else, check your network connection.
FAILED
[Pipeline] fileExists
[Pipeline] echo
### START OF CF CLI TRACE OUTPUT ###
[Pipeline] readFile
[Pipeline] echo
REQUEST: [2019-12-08T23:40:43Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2019-12-08T23:40:48Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2019-12-08T23:40:53Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)


[Pipeline] echo
### END OF CF CLI TRACE OUTPUT ###
[Pipeline] error
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
$ docker stop --time=1 680e99db9086cd3712ccf972d377a8d97791e868a6fce1342cd8fba6a14a3ab6

$ docker rm -f 680e99db9086cd3712ccf972d377a8d97791e868a6fce1342cd8fba6a14a3ab6
[Pipeline] // withDockerContainer
[Pipeline] libraryResource
[Pipeline] echo
----------------------------------------------------------
--- An error occurred in the library step: dockerExecute
----------------------------------------------------------

The following parameters were available to the step:
***
*** to show step parameters, set verbose:true in general pipeline configuration
*** WARNING: this may reveal sensitive information. ***
***

The error was:
***
hudson.AbortException: [cloudFoundryDeploy] ERROR: The execution of the deploy command failed, see the log for details.
***

Dial tcp: i/o timeout when accessing CF API endpoint in project piper using custom Jenkins setup

Hi,

I'm using this Custom Jenkins as part of project piper, however I'm not able to establish the connection to the CF API endpoint. There is no proxy necessary in my network.
I tried same directly from linux server and command 'cf login' gives me timeout error but 'CF_DIAL_TIMEOUT=15 cf login' works fine. Any ways to add CF_DIAL_TIMEOUT in parameters.

Setting api endpoint to https://api.cf.eu10.hana.ondemand.com...
Request error: Get https://api.cf.eu10.hana.ondemand.com/v2/info: dial tcp: i/o timeout
TIP: If you are behind a firewall and require an HTTP proxy, verify the https_proxy environment variable is correctly set. Else, check your network connection.
FAILED
[Pipeline] fileExists
[Pipeline] echo
### START OF CF CLI TRACE OUTPUT ###
[Pipeline] readFile
[Pipeline] echo
REQUEST: [2020-02-26T12:33:14Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-26T12:33:19Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-26T12:33:24Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-26T12:41:27Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-26T12:41:32Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-26T12:41:37Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T08:46:11Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T08:46:16Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T08:46:21Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T08:57:35Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T08:57:40Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T08:57:45Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T10:19:52Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T10:19:57Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T10:20:02Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T10:35:02Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T10:35:07Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T10:35:12Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T11:41:22Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T11:41:27Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)

REQUEST: [2020-02-27T11:41:32Z]
GET /v2/info HTTP/1.1
Host: api.cf.eu10.hana.ondemand.com
Accept: application/json
User-Agent: cf/6.46.1+4934877ec.2019-08-23 (go1.12.9; amd64 linux)


[Pipeline] echo
### END OF CF CLI TRACE OUTPUT ###
[Pipeline] error
[Pipeline] }
[Pipeline] // withCredentials

python3 not installed

the current image is very slim, however it would be very useful if it would have also python3 available and also the json library for python3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.