Skip to content

Issue while creating a resource type #2127

Closed

Description

@sahotay

Hello there!

I'm having issues while creating new resource type for concourse ci. The resource type is to run a cli present in one docker image.

PS: I'm new to concourse :(

  1. My resource type image is
$ docker build -t myorg.domain.com/alpine_twistcli:latest .
Sending build context to Docker daemon  29.09MB
Step 1/5 : FROM alpine:latest
 ---> 3fd9065eaf02
Step 2/5 : RUN apk update  && apk **add jq curl bash  && rm -rf /var/cache/apk/***
 ---> Using cache
 ---> fc8ee0f722e8
Step 3/5 : COPY **twistcli /usr/bin/twistcli** **//copying cli here** 
 ---> Using cache
 ---> 582eb35ef3bd
Step 4/5 : **COPY assets/ /opt/resource/**  //copying resources here
 ---> 5c5edecd15b8
Step 5/5 : RUN chmod +x /opt/resource/out /opt/resource/in /opt/resource/check  /opt/resource/twisthelp.sh
 ---> Running in f2b1e7654172
 ---> fa66b0b4b0e5
Removing intermediate container f2b1e7654172
Successfully built fa66b0b4b0e5
Successfully tagged myorg.domain.com/alpine_twistcli:latest

  1. Check, in and out are very basic

$ cd assets && cat check in out
/home/demo/resources/assets

#!/bin/bash
echo "[]"
#!/bin/bash
echo '{"version":{"ref":"none"}}'
#!/bin/sh
set -e
exec 3>&1
exec 1>&2
/opt/resource/twisthelp.sh

where: /opt/resource/twisthelp.sh contains #!/bin/bash twistcli --help

  1. Here is my pipeline
jobs:
- name: build-docker-image
  public: false
  serial: true
  plan:
  - get: git-image-repo
    trigger: true
  - put: docker-image
    params:
      build: git-image-repo

- name: scan-docker-image
  public: false
  serial: true
  plan:
  - get: docker-image
    trigger: true
    passed: [build-docker-image]
    - task: scan images
      config:
      platform: linux
      image_resource:
        type: twist-scan
        source: {repository: myorg.domain.com/alpine_twistcli}
      run:
        path: twistlock
        args: ["--version"]


resource_types:
- name: image-scan
  type: docker-image
  source:
    repository: myorg.domain.com/alpine_twistcli
    tag: latest

resources:
- name: twist-scan
  type: image-scan
  source:
    twist_uri: {{application-url}}
    image_name: twistcliscan

- name: git-image-repo
  type: git
  check_every: 15s
  source:
    uri: {{git-repo}}
    paths: [Dockerfile]
    branch: integration
    private_key: {{git-private-key}}

- name: docker-image
  type: docker-image
  source:
    email: {{docker-hub-email}}
    username: {{docker-hub-username}}
    password: {{docker-hub-password}}
    repository: {{docker-image-repo}}

The error I'm getting is on twist-scan and it is:-

invalid character h looking for the beginning of value

Activity

  1. sahotay commented on Apr 5, 2018

    @sahotay
    Author

    @vito can you please help me

  2. vito commented on Apr 5, 2018

    @vito
    Contributor

    That error means that something printed an h (probably more) to stdout, which is reserved for the JSON response value.

    Where are you seeing the error?

  3. sahotay commented on Apr 5, 2018

    @sahotay
    Author

    Something strange, as I was doing many changing and not sure which one worked to get the first error fixed :)
    Here is my pipeline

    image

    Here is error
    unexpected end of JSON input
    image

  4. vito commented on Apr 5, 2018

    @vito
    Contributor

    That error is probably from the resource not printing a response object.

    Be sure to follow Implementing a Resource carefully!

  5. jama22 commented on Apr 9, 2018

    @jama22

    Closing issue, since it seems to be more support related. @rahul-github feel free to re-open if you feel like there's a genuine bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions