Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

upload-and-stage-ert job's upload-ert-and-stemcell task fails in case of no product dependencies #243

Closed
outofmem0ry opened this issue Dec 3, 2017 · 2 comments
Labels

Comments

@outofmem0ry
Copy link

If a pivnet product version has no dependencies. Example - pivnet rds -p <product_name> -r

+----+---------+------------+--------------+
| ID | VERSION | PRODUCT ID | PRODUCT NAME |
+----+---------+------------+--------------+
+----+---------+------------+--------------+

The metadata.json has dependencies key set to null "Dependencies": null,. While running upload-ert-and-stemcell task pcf-pipelines/tasks/upload-product-and-stemcell/task.sh the pipeline errors out with can not iterate over null

cat ./pivnet-product/metadata.json |
>   jq --raw-output \
>     '
>     [
>       .Dependencies[]
>       | select(.Release.Product.Name | contains("Stemcells"))
>       | .Release.Version
>     ]
>     | map(split(".") | map(tonumber))
>     | transpose | transpose
>     | max // empty
>     | map(tostring)
>     | join(".")
>     '
jq: error (at <stdin>:0): Cannot iterate over null (null)

The same will occur while downloading stemcell version pcf-pipelines/tasks/upload-product-and-stemcell/task.sh

 if [[ -z "$stemcell" ]]; then
    echo "Downloading stemcell $STEMCELL_VERSION"

    product_slug=$(
      jq --raw-output \
        '
        if any(.Dependencies[]; select(.Release.Product.Name | contains("Stemcells for PCF (Windows)"))) then
          "stemcells-windows-server"
        else
          "stemcells"
        end
        ' < pivnet-product/metadata.json
    )
jq --raw-output \
>         '
>         if any(.Dependencies[]; select(.Release.Product.Name | contains("Stemcells for PCF (Windows)"))) then
>           "stemcells-windows-server"
>         else
>           "stemcells"
>         end
>         ' < pivnet-product/metadata.json
jq: error (at <stdin>:0): Cannot iterate over null (null)

Am not sure how likely it is that the pivnet product version will have no dependencies but we should be able to handle null conditions.

Let me know and I can submit a PR to fix this.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story.

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

@abbyachau
Copy link
Contributor

Hi @outofmem0ry thanks for this. I'm going to close this in favour of the pull request you created: #244. Thanks again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants