cloudfoundry / cf-deployment-concourse-tasks

Apache License 2.0
23 stars 76 forks source link

cf tail command not found in docker image. #79

Closed arthomps closed 5 years ago

arthomps commented 5 years ago

Our CATs tests started failing recently with the error:

'tail' is not a registered command. See 'cf help -a'

After some tracing, what I believe has happened is that CATs set the use-log-cache option to default to true whereas it used to be false by default.

https://github.com/cloudfoundry/cf-acceptance-tests/commit/63c12afa94037a3e6a9e4a13495a0a0e6d05b3a8

This may be a reasonable change. But for users who are using the docker image defined in cf-deployment-concourse-tasks, it seems to be missing the appropriate command. Is it possible to get https://github.com/cloudfoundry/log-cache-cli installed in the cf-deployment-concrouse-tasks docker image?

As a work around for anybody else running into this, you can turn off the use-log-cache in your cats config and the old behaviour will be restored. at least up until cf 4.4, I haven't checked past that.

cf-gitbot commented 5 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/160964070

The labels on this github issue will be updated when the story is started.

ishustava commented 5 years ago

Hey @arthomps

log-cache-cli was added to the docker image about 7 months ago with this commit da91fc5f88d3a279236cd5cdfa0877ed900b921e. This corresponds to cf-deployment-concourse-tasks v6.3 or higher.

Which version are you using?

As a workaround, if you are on an earlier version, you can override the docker image version in your pipeline following these steps:

  1. Add docker image resource (v5.5.0 or higher will have log-cache-cli)
    resources:
    - name: cf-deployment-concourse-tasks-docker-image-v5-5-0
       type: docker-image
       source:
          repository: relintdockerhubpushbot/cf-deployment-concourse-tasks
          tag: v5.5.0
  2. Override image for each task that needs it:
    jobs:
    - name: run-cats
      plan:
      - get: cf-deployment-concourse-tasks-docker-image-v5-5-0
       ...  
      - task: run-cats
        image: cf-deployment-concourse-tasks-docker-image-v5-5-0
        file: cf-deployment-concourse-tasks/run-cats/task.yml
arthomps commented 5 years ago

The docker image we use is the default one defined in the task.yml files. For example, https://github.com/cloudfoundry/cf-deployment-concourse-tasks/blob/master/bosh-deploy/task.yml#L4

For the particular build in question, that would have been:

image_resource:
  type: docker-image
  source:
    repository: relintdockerhubpushbot/cf-deployment-concourse-tasks
    tag: v5.22.0
ishustava commented 5 years ago

Probably the issue is not the docker image.

I've pulled this version of the docker image locally and ran it. I can see log-cache cf cli plugin is installed:

$ docker run -it relintdockerhubpushbot/cf-deployment-concourse-tasks:v5.22.0 /bin/bash
root@1685d7461011:/# cf plugins
Listing installed plugins...

plugin      version   command name   command help
log-cache   N/A       log-meta       Show all available meta information
log-cache   N/A       tail           Output logs for a source-id/app

Use 'cf repo-plugins' to list plugins in registered repos available to install.
root@1685d7461011:/# cf tail -h
NAME:
   tail - Output logs for a source-id/app

USAGE:
   tail [options] <source-id/app>

ENVIRONMENT VARIABLES:
   LOG_CACHE_ADDR       Overrides the default location of log-cache.
   LOG_CACHE_SKIP_AUTH  Set to 'true' to disable CF authentication.

OPTIONS:
   --gauge-name                 Gauge name filter (implies --envelope-type=gauge).
   --json                       Output envelopes in JSON format.
   --lines, -n                  Number of envelopes to return. Default is 10.
   --start-time                 Start of query range in UNIX nanoseconds.
   --counter-name               Counter name filter (implies --envelope-type=counter).
   --end-time                   End of query range in UNIX nanoseconds.
   --envelope-type, -type       Envelope type filter. Available filters: 'log', 'counter', 'gauge', 'timer', and 'event'.
   --follow, -f                 Output appended to stdout as logs are egressed.

How are you running CATs? Are you using run-cats task?

arthomps commented 5 years ago

Thank you, that points me in the correct direction. I had been running https://github.com/cloudfoundry/cats-concourse-task/blob/master/task.yml. Which is clearly not using the docker image that I had thought was being used.