Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
100 stars 28 forks source link

environment variable is missing #5127

Open magwas opened 4 years ago

magwas commented 4 years ago

Description of your issue:

Our build needs an environment variable called 'issuetoken'. It is in a key-value integration called 'kkpipeline'. I am the owner of the project, and set the integration. For me, the build is green. In pull requests, the build fails, because the environment variable is missing.

It was working until we converted the private project to a public one.

https://app.shippable.com/github/kode-konveyor/TaskMarket/runs/33/1/console

a-murphy commented 4 years ago

This seems to be a duplicate of https://github.com/Shippable/support/issues/4955. Secure variables are not decrypted for pull requests to public repositories. One option may be to replace your runCI job with a runSh job with a gitRepo input. runSh jobs won't check the source of the pull request because changes to the YML won't be reflected in the runSh script run for the pull request.

magwas commented 4 years ago

How do I define a runSh job which is meant to run within a custom docker container?

I came up with the following shippable.yml, but it boots up a ruby container and generally wants to run ruby: See https://app.shippable.com/github/kode-konveyor/TaskMarket/runs/38/1/console

jobs:
  - name: kk_build
    type: runSh
    runtime:
       options:
         imageName: kodekonveyor/toolchain
         imageTag: 3.6
         options: --rm -e issuetoken -e sonarkey -v $(pwd):/build -w /build
    steps:
    integrations:
      key:
        - integrationName: kodekonveyor
          type: sshKey
      generic:
        - integrationName: kkpipeline
      TASK:
          name: build
          script:
            - /usr/local/toolchain/tools/Script
            - /usr/local/toolchain/tools/publish

Original shippable.yml:

build_image: kodekonveyor/toolchain:3.6
language: python
python:
  - 2.7
integrations:
  key:
    - integrationName: kodekonveyor
      type: sshKey
  generic:
    - integrationName: kkpipeline

build:
  ci:
    - /usr/local/toolchain/tools/Script
  on_success:
    - /usr/local/toolchain/tools/publish
  on_failure:
    - /usr/local/toolchain/tools/publish
magwas commented 4 years ago

I figured out that I have to have a dedicated branch for that shippable.yml, and add it as an assembly line. Did that, but the imageTag option does not seem to be honoured, and no sign of actually running the script. https://app.shippable.com/github/kode-konveyor/jobs/use_custom_image/builds/5f12a4ef8877510006fb1fac/console

a-murphy commented 4 years ago

Could you try the following?

jobs:
  - name: kk_build
     type: runSh
     steps:
       - TASK:
          name: build
          runtime:
            options:
              imageName: kodekonveyor/toolchain
              imageTag: 3.6
              options: --rm -v $(pwd):/build -w /build
          script:
            - /usr/local/toolchain/tools/Script || true
            - /usr/local/toolchain/tools/publish
    integrations:
        - kodekonveyor
        - kkpipeline

The scripts should be in tasks under the steps section of the runSh job, so the script wouldn't have been found. I'm not sure why your tag wasn't found, however, and it looks like the linked run no longer exists.