Skip to content

get last successful app version #323

Open

Description

@piyush94

Is there a way to get the last application version of which deployment was successful from the API?
We have the application name.

Activity

  1. piyush94 commented on Dec 18, 2020

    @piyush94
    Author

    We are trying to automate the rollback to the last successful application version from Jenkins. Any suggestions?

  2. sbtaylor15 commented on Dec 18, 2020

    @sbtaylor15
    Contributor

    I know there is an API to get the last version. I need to check on grabbing the last successful one.

  3. piyush94 commented on Dec 18, 2020

    @piyush94
    Author

    Getting the Latest version i checked. It works but one bug was there in Jenkins library. It takes last version in versions array as latest but the new versions were at the top in the array in the API response. So I changed the .last() to .first() in the groovy code.

  4. piyush94 commented on Dec 24, 2020

    @piyush94
    Author

    Can't use .last() or .first() as well as the API response is not sorted.

    "versions": [
          {
            "id": 513,
            "name": "cf-deploy;3_5_0_backend_dev_105",
            "summary": ""
          },
          {
            "id": 514,
            "name": "cf-deploy;3_5_0_backend_dev_106",
            "summary": ""
          },
          {
            "id": 517,
            "name": "cf-deploy;3_5_0_backend_dev_109",
            "summary": ""
          },
          {
            "id": 510,
            "name": "cf-deploy;3_5_0_frontend_qa_89",
            "summary": ""
          },
          {
            "id": 500,
            "name": "cf-deploy;prod_demo",
            "summary": ""
          }
        ],
    

    Isn't there a built-in way in DeployHub to rollback to the last successful deployment?

  5. sbtaylor15 commented on Jan 6, 2021

    @sbtaylor15
    Contributor

    Added getLastSuccessfulAppVersion(String url, String userid, String pw, String applicationid) which will return the appid of the last successful application version.

    Use the updateattrs branch for the groovy script and image ui-skin-v9.0.0.3088-gaa30fe0 for the new ui and image master-v9.0.0.2937-g5ae292f for the old ui

  6. sbtaylor15 commented on Jan 7, 2021

    @sbtaylor15
    Contributor

    Added envid as parameter to getLastSuccessfulAppVersion(String url, String userid, String pw, String applicationid, String envid).

    Use the updateattrs branch for the groovy script and image ui-skin-v9.0.0.3090-gd18917f and master-v9.0.0.2939-g2cba1b0

  7. piyush94 commented on Jan 11, 2021

    @piyush94
    Author

    The function call returns an array, the rollback application id is at which location. And in the passing parameter applicationid, is it the base version id or the latest id?

  8. sbtaylor15 commented on Jan 13, 2021

    @sbtaylor15
    Contributor

    @piyush94 We had the wrong return type on the groovy doc as an id.

    You are right, that it's an array:

    1. application id for the latest successful deployment for the environment
    2. application name
    3. application id for latest version in version tree

    You can pass in the application id of the app you just deployed or the app base version id.

  9. piyush94 commented on Jan 28, 2021

    @piyush94
    Author

    @sbtaylor15 we are facing issue when creating application version from a branched application. From UI it works fine but from jenkins it doesn't.
    cfdeploy-error

    From UI it creates app version from the latest version i.e cf-deploy;3_5_0_frontend_dev_144. But from jenkins it creates app version from cf-deploy;prod_demo. In jenkins we use newApplication function.

  10. sbtaylor15 commented on Jan 28, 2021

    @sbtaylor15
    Contributor

    @piyush94 so you want cf-deploy;prod_demo have the parent of cf-deploy;3_5_0_frontend_dev_144, correct?

  11. piyush94 commented on Jan 28, 2021

    @piyush94
    Author

    @sbtaylor15 the new version should come under cf-deploy;3_5_0_frontend_dev_144 which is the latest version as shown below. But Jenkins library is adding it under cf-deploy;prod_demo.
    image

    Branching would remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions