cloudfoundry / cloudfoundry/multiapps-cli-plugin

Hanging forever in several pipeline configurations

Open
#200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
87
Forks
42
Avg merge
17d 21h
Merged PRs (30d)
1

Description

Description

If pipeline starts docker container with -a stdin parameter then, stdin will always be a pipe and not a char device, so this check will always be true, however if no process is writing to the stdin, then this read will be hanging forever if you're trying to deploy a deployment descriptor.

Your environment
  • MultiApps CF CLI Plugin version - 3.2.2
Steps to reproduce
  • create any valid mtad.yaml file, e.g:
ID: "my-mta"
_schema-version: 3.3.0
version: 0.0.0

resources:
- name: my-cf-service-instance-resource
  type: org.cloudfoundry.managed-service
  parameters:
    service-plan: "lite" # set the service plan to use
    service: application-logs #set the service offering (label)
  • create script
cf login -a ${$.env.CF_API} -u ${CF_USERNAME} -p ${CF_PASSWORD} -o ${CF_ORG} -s ${CF_SPACE} # replace with proper values
DEBUG=1  cf deploy
  • create a Dockerfile
FROM ppiper/cf-cli

WORKDIR /app
COPY mtad.yaml /app/
COPY runme.sh /app/

CMD [ "/bin/bash", "/app/runme.sh" ]
  • build docker image with docker build -t test:test .
  • run a container with docker run -i -a stdin test:test, and notice the container id
  • check docker logs with docker logs 332f45a33eb583f08da40b4ec3cc5bfe5ef7be5e9163f00d38959944fe2ae52e, where 332f45a33eb583f08da40b4ec3cc5bfe5ef7be5e9163f00d38959944fe2ae52e is the id from the previous step
  • you'll see hanging forever deployment with output similar to:
API endpoint: https://api.cf.BTP


Authenticating...
OK

Targeted org YOUORG.

Targeted space your-space.

API endpoint:   https://api.cf.BTP
API version:    3.159.0
user:           CF_USERNAME
org:            YOUORG
space:         your-space
Initializing command "deploy"
Executing command 'deploy': args: '[]'
a
abort-on-error false
all-modules false
all-resources false
delete-service-brokers false
delete-service-keys false
delete-services false
do-not-fail-on-missing-permissions false
e
f false
i
keep-files false
m []
namespace
no-restart-subscribed-apps false
no-start false
r []
retries 3
skip-idle-start false
skip-ownership-validation false
skip-testing-phase false
strategy default
t
u
version-rule

I'm thinking that actually waiting forever for anything in the code is generally a bad practice, so you may want to add some type of timeout for waiting for input and command line parameter like --ignore-stdin not to try to read from stdin at all.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in commands/deploy_command.go at the stdin check and read around lines 505-507, then reproduce the hang with the provided mtad.yaml, Dockerfile, and docker run -i -a stdin test:test setup. Done means a deployment descriptor no longer waits forever when stdin is a pipe with no writer; the issue leaves the exact timeout or ignore-stdin behavior to determine.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.