[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: wait for build triggered by new-app


   I appreciate the pointer, but this doesn't seem to do the right thing. Here is the relevant portion of my code:

oc new-app --name=teams git@<enterprise git repo> -e MONGODB_USER=uuuu -e MONGODB_PASSWORD=pppp -e MONGODB_HOST=mongodb -e MONGODB_PORT=27017 -e MONGODB_DATABASE=teamdb --source-secret=<enterprise git secret>
#  Adding waits for teams and teams-1 because the build resource seems to be teams-1
oc wait build/teams --for="">oc wait build/teams-1 --for="">

   And here is the output:

warning: Cannot check if git requires authentication.
--> Found container image 1db9786 (6 months old) from docker.io for "docker.io/websphere-liberty:javaee8"

    * An image stream tag will be created as "websphere-liberty:javaee8" that will track the source image
    * A Docker build using source code from git@<enterprise git repo> will be created
      * The resulting image will be pushed to image stream tag "teams:latest"
      * Every time "websphere-liberty:javaee8" changes a new build will be triggered
      * WARNING: this source repository may require credentials.
                 Create a secret with your git credentials and use 'oc set build-secret' to assign it to the build config.
    * This image will be deployed in deployment config "teams"
    * Ports 9080/tcp, 9443/tcp will be load balanced by service "teams"
      * Other containers can access this service through the hostname "teams"

--> Creating resources ...
    imagestream.image.openshift.io "websphere-liberty" created
    imagestream.image.openshift.io "teams" created
    buildconfig.build.openshift.io "teams" created
    deploymentconfig.apps.openshift.io "teams" created
    service "teams" created
--> Success
    Build scheduled, use 'oc logs -f bc/teams' to track its progress.
    Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
     'oc expose svc/teams'
    Run 'oc status' to view your app.
Error from server (NotFound): builds.build.openshift.io "teams" not found
Error from server (NotFound): builds.build.openshift.io "teams-1" not found
deploymentconfig.apps.openshift.io/teams patched
deploymentconfig.apps.openshift.io/teams patched
error: timed out waiting for the condition on deploymentconfigs/teams
error: no matching resources found
route.route.openshift.io/teams exposed
route.route.openshift.io/teams patched
The teams api is now available at http://teams.<a domain name>

    At this point, I can see that the build resource has been created, even though the "wait" that I tried to put in place has not worked.

[zaphod oc3027208274 gatt]$ oc get builds
NAME      TYPE     FROM          STATUS    STARTED          DURATION
teams-1   Docker   Git b4dba21   Running   36 seconds ago  
[zaphod oc3027208274 gatt]$ 

     What am I doing wrong?


On Wed, May 6, 2020 at 11:52 AM Ben Parees <bparees redhat com> wrote:

On Wed, May 6, 2020 at 11:34 AM Just Marvin <marvin the cynical robot gmail com> wrote:

    I've been trying to write a script that runs various commands following a new-app. These commands will operate on the dc created by new-app, but fail if the resources haven't reached the right stage, so I'd like to wait for the build to complete. Unfortunately, I can't seem to figure out the right condition to wait for using the "oc wait" command. Does anyone have a suggestion? Wait on the bc or the build or.... (and for what condition)?

oc wait build/buildresourcename --for="">

unfortunately that won't help if the build in question fails (Complete means success) so set your timeout appropriately.


users mailing list
users lists openshift redhat com

Ben Parees | OpenShift

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]