jx preview using using ORG and APP_NAME in jenkins file?

Created on 16 Oct 2018  路  5Comments  路  Source: jenkins-x/jx

When submitting a PR, the jenkins file instructs the jenkins build to perform a make build, which has the output

[preview] Running shell script
+ make preview
sed -i -e "s/version:.*/version: 0.0.0-SNAPSHOT-PR-2-10/" Chart.yaml
sed -i -e "s/version:.*/version: 0.0.0-SNAPSHOT-PR-2-10/" ../*/Chart.yaml
sed -i -e "s|repository: .*|repository: xxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com\/moneylion\/ddaapi|" values.yaml
sed -i -e "s/tag: .*/tag: 0.0.0-SNAPSHOT-PR-2-10/" values.yaml
echo "  version: 0.0.0-SNAPSHOT-PR-2-10" >> requirements.yaml
jx step helm build
No $CHART_REPOSITORY defined so using the default value of: http://jenkins-x-chartmuseum:8080
Using helmBinary helm with feature flag: none
Adding missing Helm repo: jenkins-x https://chartmuseum.build.cd.jenkins-x.io
Successfully added Helm repository jenkins-x.
Adding missing Helm repo: releases http://jenkins-x-chartmuseum:8080
Successfully added Helm repository releases.

What I'm confused about is the next step performs a jx preview --app dda-api --dir ../.., which has the output

expose:
  config:
    domain: subdomain.domain.com
    exposer: ""
    http: ""
    tlsacme: ""
    pathMode: ""
preview:
  image:
    repository: xxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/moneylion/dda
    tag: 0.0.0-SNAPSHOT-PR-2-10
Using helmBinary helm with feature flag: none
error: failed to run 'helm upgrade --namespace jx-moneylion-ddaapi-pr-2 --install --wait --force --values /home/jenkins/workspace/MoneyLion_ddaapi_PR-2-ORUSID4ZPSTKXOTMKM4GFWBSFEDGG3UE2CV7COK65HE7KF6OTHZQ/charts/preview/extraValues.yaml jx-moneylion-ddaapi-pr-2 .' command in directory '', output: 'Release "jx-moneylion-ddaapi-pr-2" does not exist. Installing it now.
Error: release jx-moneylion-ddaapi-pr-2 failed: timed out waiting for the condition': exit status 1
script returned exit code 1

It seems the repository field is constructing the ECR repo url based on the ORG and APP_NAME from the jenkins file instead of using this command from the makefile.

sed -i -e "s|repository: .*|repository: xxxxxxx.dkr.ecr.us-east-1.amazonaws.com\/moneylion\/ddaapi|" values.yaml

As you can see, the sed line is using moneylion/ddaapi while the helm upgrade command ends up using moneylion/dda, which isn't the repo that I've instructed it to use.

Why is that? It seems we are putting the docker repo url in a few different places but the jx preview command seems to be constructing the URL from a different source so its been a lot of trial and error trying to figure out how to get this build working and using the right ECR repo. My biggest concern is what if we want this build to be building 2 helm charts from 2 different ECR repos? If its using the ORG and APP_NAME vars from the jenkins file, it seems we are only able to build 1 helm chart from 1 ECR repo. Is this right or do I have something configured wrong?

arepreview kinbug lifecyclrotten prioritimportant-soon

Most helpful comment

Looking at the code, I've confirmed that jx preview does construct the image name from the ORG and APP_NAME variables from the Jenkinsfile. My question is why isn't it pulling the image name from the values.yaml file after the

sed -i -e "s|repository: .*|repository: xxxxxxx.dkr.ecr.us-east-1.amazonaws.com\/moneylion\/ddaapi|" values.yaml

command is executed from the Makefile?

For spring apps that contain 2 modules for example, this makes it difficult to have the Jenkinsfile be flexible on which module/docker repo to use when building the preview environment since it will only ever be able to target one image name aka APP_NAME.

All 5 comments

Looking at the code, I've confirmed that jx preview does construct the image name from the ORG and APP_NAME variables from the Jenkinsfile. My question is why isn't it pulling the image name from the values.yaml file after the

sed -i -e "s|repository: .*|repository: xxxxxxx.dkr.ecr.us-east-1.amazonaws.com\/moneylion\/ddaapi|" values.yaml

command is executed from the Makefile?

For spring apps that contain 2 modules for example, this makes it difficult to have the Jenkinsfile be flexible on which module/docker repo to use when building the preview environment since it will only ever be able to target one image name aka APP_NAME.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Provide feedback via https://jenkins-x.io/community.
/lifecycle rotten

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Provide feedback via https://jenkins-x.io/community.
/close

@jenkins-x-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.
Provide feedback via https://jenkins-x.io/community.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Was this page helpful?
0 / 5 - 0 ratings