redhat-actions / openshift-tools-installer

Download, install and cache OpenShift binaries into your GitHub Actions runners.
https://github.com/marketplace/actions/openshift-tools-installer
MIT License
22 stars 21 forks source link

Error: Cache service responded with 404 on GHES #17

Closed anthonydahanne closed 3 years ago

anthonydahanne commented 3 years ago

Version

redhat-actions/openshift-tools-installer@v1

Tested on Github Entreprise Server 3.0 (on premise Github)

Describe the bug

With any tools being installed, the installation will crash with Error: Cache service responded with 404

Steps to reproduce, workflow links, screenshots

Using such a configuration:

      - name: Install CLI tools
        uses: redhat-actions/openshift-tools-installer@v1
        with:
          helm: latest
          oc: latest

will end up with such a crash:

Installing helm matching version "latest"
Installing oc matching version "latest"

πŸ”Ž Searching for the latest version of helm
Download directory for helm is https://mirror.openshift.com/pub/openshift-v4/clients/helm/
Latest release of helm is 3.5.0
Current operating system is linux
Current architecture is amd64
Selecting helm-linux-amd64.tar.gz
Using GITHUB_WORKSPACE for storage
πŸ“ CLIs will be downloaded to /usr/local/actions-runner/_work/anthony-mai/anthony-mai/openshift-bin
Added /usr/local/actions-runner/_work/anthony-mai/anthony-mai/openshift-bin to PATH
Checking the cache for helm 3.5.0...
Error: Error: Cache service responded with 404

πŸ”Ž Searching for the latest version of oc
Download directory for oc is https://mirror.openshift.com/pub/openshift-v4/clients/ocp/
Latest release of oc is 4.7.10
Selecting openshift-client-linux-4.7.10.tar.gz
Checking the cache for oc 4.7.10...
Error: Error: Cache service responded with 404

❌ Failed to install helm and oc.

Workaround

If you set the environment variable named CLI_INSTALLER_SKIP_CACHE to true, crahs won't occur (but cache won't be leveraged though...)

        env:
          CLI_INSTALLER_SKIP_CACHE: true
tetchel commented 3 years ago

I think this is just not supported on GHES and you will not be able to use the caching feature. https://github.com/actions/cache/issues/505

tetchel commented 3 years ago

... in which case, it would make sense for this action to skip the cache by default if it's running on GHE. I wonder if there's API to detect that.

tetchel commented 3 years ago

closing pending anything further we can do.

anthonydahanne commented 3 years ago

hello @tetchel - thanks for the reply.

I wonder if there's API to detect that.

There seems to be, but it's pretty basic: https://github.com/actions/cache/blob/main/src/utils/actionUtils.ts#L5

closing pending anything further we can do.

okee makes sense, I see you updated the documentation per https://github.com/redhat-actions/openshift-tools-installer/commit/3d239aef6a6eca55daee7967034c4ce9804ee504 , so all is fine I guess.

thanks

tetchel commented 3 years ago

it also won't crash anymore, it will just log a bunch of warnings.

tetchel commented 3 years ago

good to know about that env var GITHUB_SERVER_URL https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables

I looked in the ${{ github }} context and it wasn't there, I should have checked the env vars list too.

tetchel commented 3 years ago

i opened #19 to improve this behaviour using that env var.