Page MenuHomePhabricator

Jenkins PipelineLib runner failing because `${build-npm.imageID}` is not expanded
Closed, InvalidPublic

Description

https://wikitech.wikimedia.org/wiki/PipelineLib/Guides/How_to_define_a_node_test_pipeline shows setting up your blubber.yaml with a npm run-script variant and then reusing that container to run multiple steps that are all some variation of npm run-script ....

Following this advice leads to failures on Jenkins such as:

[lint-npm] exec docker run --rm sha256:'${build-npm.imageID}' 'lint'
[lint-npm] + set +x

docker: invalid reference format.
See 'docker run --help'.

Note the '${build-npm.imageID}' literal there and not some hash that was captured earlier.

Event Timeline

I'm actually unsure now if the problem is exactly the set +x injection or instead that the ${build-npm.imageID} is possibly not being expanded properly...

I'm actually unsure now if the problem is exactly the set +x injection or instead that the ${build-npm.imageID} is possibly not being expanded properly...

Yeah, I totally misread the Jenkins output and Groovy code. The problem I am having is that the image id is not being expanded. It is instead being passed literally to the runner as shown in exec docker run --rm sha256:'${build-npm.imageID}' 'lint'. Does this mean that my .pipeline/config.yaml is malformed?

.pipeline/config.yaml
pipelines:
  test:
    blubberfile: blubber.yaml
    stages:
      - name: build-python
        build: dev-python
        run: false
      - name: lint-python
      - name: test-python
        run:
          env:
            DJANGO_SECRET_KEY: dummy value for use in tests
            DB_ENGINE: django.db.backends.sqlite3
            DB_NAME: ":memory:"

      - name: build-npm
        build: npm-run
        run: false
      - name: lint-npm
        run:
          image: '${build-npm.imageID}'
          arguments:
            - lint
      - name: test-npm
        run:
          image: '${build-npm.imageID}'
          arguments:
            - test

    execution:
      - [build-python, lint-python]
      - [build-python, test-python]
      - [build-npm, lint-npm]
      - [build-npm, test-npm]
bd808 renamed this task from Jenkins PipelineLib runner does not work with examples from Wikitech guide for nodejs to Jenkins PipelineLib runner failing because `${build-npm.imageID}` is not exapnded.Oct 21 2020, 11:18 PM
bd808 renamed this task from Jenkins PipelineLib runner failing because `${build-npm.imageID}` is not exapnded to Jenkins PipelineLib runner failing because `${build-npm.imageID}` is not expanded.
bd808 updated the task description. (Show Details)

Change 635672 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[wikimedia/toolhub@main] .pipeline: Stop reusing a built container for npm

https://gerrit.wikimedia.org/r/635672

bd808 removed a project: Patch-For-Review.

I'm going to close this as invalid until I can show my pipeline running without this aspect.