Uploaded image for project: 'Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces) '
  1. Red Hat OpenShift Dev Spaces (formerly CodeReady Workspaces)
  2. CRW-2483

migrate from hub to gh (or use pure GH API) to avoid collisions when uploading files to GH releases

    XMLWordPrintable

Details

    • False
    • False

    Description

      I recently switched the sync-to-downstream job from sequential to paralle when uploading assets to GH.

      Unfortunately, a race condition can occur resulting in

      23:51:11  + ./uploadAssetsToGHRelease.sh --publish-assets -v 2.14.0 -b crw-2-rhel-8 -n plugin-java8 /var/lib/jenkins/workspace/CRW_CI/sync-to-downstream_2.x/codeready-workspaces-stacks-language-servers-dependencies-node10-s390x.tar.gz
      23:51:11  + ./uploadAssetsToGHRelease.sh --publish-assets -v 2.14.0 -b crw-2-rhel-8 -n plugin-java8 /var/lib/jenkins/workspace/CRW_CI/sync-to-downstream_2.x/codeready-workspaces-stacks-language-servers-dependencies-node10-ppc64le.tar.gz
      
      23:51:12  https://github.com/redhat-developer/codeready-workspaces-images/releases/tag/2.14.0-plugin-java8-assets
      23:51:12  Upload new asset /var/lib/jenkins/workspace/CRW_CI/sync-to-downstream_2.x/codeready-workspaces-stacks-language-servers-dependencies-node10-s390x.tar.gz
      23:51:12  https://github.com/redhat-developer/codeready-workspaces-images/releases/tag/2.14.0-plugin-java8-assets
      23:51:12  Upload new asset /var/lib/jenkins/workspace/CRW_CI/sync-to-downstream_2.x/codeready-workspaces-stacks-language-servers-dependencies-node10-ppc64le.tar.gz
      23:51:12  Error editing release: Unprocessable Entity (HTTP 422)
      23:51:12  Duplicate value for "tag_name"
      

      One option to work around this is to switch back to running in sequence instead of parallel.

      Another option would be to use gh instead of *hub cli:

      1. update jenkinsfiles to compile from sources for z and p support: https://github.com/cli/cli/blob/trunk/docs/source.md
      2. use gh instead of hub:

      gh cli has a --clobber option to overwrite existing assets
      gh release upload "${CSV_VERSION}-${ASSET_NAME}-assets" codeready-workspaces-stacks-language-servers-dependencies-python-ppc64le.tar.gz --repo redhat-developer/codeready-workspaces-images --clobber
      Successfully uploaded 1 asset to 2.14.0-plugin-java8-assets
      

      vs.

      hub has no ability to overwrite
      $➔ hub release edit -a "${fileToPush}#$(uname -m)" "${CSV_VERSION}-${ASSET_NAME}-assets" \
      >       -m "Assets for the ${CSV_VERSION} ${ASSET_NAME} release" -m "Container build asset files for ${CSV_VERSION}"
      Error editing release: Unprocessable Entity (HTTP 422)
      Duplicate value for "tag_name"
      

      Alternatively, we could also just use the standard GH API with curl -XPOST to upload a file. Not sure if that option allows for clobbering existing files/tags_names

      Attachments

        Activity

          People

            nickboldt Nick Boldt
            nickboldt Nick Boldt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: