Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize by allowing latest versions installed to be used #39

Closed
x448 opened this issue Jan 28, 2020 · 18 comments
Closed

Optimize by allowing latest versions installed to be used #39

x448 opened this issue Jan 28, 2020 · 18 comments
Labels
external Unexpected behavior was caused by external problems

Comments

@x448
Copy link

x448 commented Jan 28, 2020

Currently, using setup-go can take roughly 10 seconds.

Having setup-go update a symlink to point to a preinstalled Go should take less than 1 second. The current way of installing Go can continue to be used for versions not preinstalled.

The ubuntu-latest image lists Go 1.11, 1.12, 1.13, 1.14 in their release notes.

@x448 x448 changed the title Preinstall latest 2-3 releases of Go and update symlink (10s --> 1s optimization) Too slow. Preinstall latest 2-3 releases of Go and update symlink (10s --> 1s optimization) Jan 28, 2020
@x448
Copy link
Author

x448 commented Feb 11, 2020

If adding multiple preinstalled Go versions to ubuntu-latest or windows-latest, etc. isn't approved, maybe ubuntu-latest-go or windows-latest-go has a better shot at getting approved?

This would be useful for any language that releases often (like Rust, having ubuntu-latest-rust).

@bryanmacfarlane
Copy link
Member

bryanmacfarlane commented Feb 11, 2020

We don't even need to do the symlink approach. image generation just needs to have more versions pre-installed in the cache layout. If that's done, it will be instant for the version hits (common ones on the image) and only take the 10 second hit if it's a miss.

Also, if you want to use the preinstalled go, then just don't use setup-go action and that one will be in your path. Be aware - that one slides on you as new versions come out.

@bryanmacfarlane
Copy link
Member

If adding multiple preinstalled Go versions to ubuntu-latest or windows-latest, etc. isn't approved

Do you have an issue number?

@x448
Copy link
Author

x448 commented Feb 11, 2020

If adding multiple preinstalled Go versions to ubuntu-latest or windows-latest, etc. isn't approved

Do you have an issue number?

Nope, this is the only issue I opened with GitHub. I didn't know if better approaches were available to setup-go behind the scenes.

@tjanez
Copy link

tjanez commented Feb 25, 2020

Also, if you want to use the preinstalled go, then just don't use setup-go action and that one will be in your path. Be aware - that one slides on you as new versions come out.

I think that's the main reason why one would want to use the setup-go action rather than just use whatever Go version is in the PATH, namely to prevent breaking CI when a new version, e.g. Go 1.14, is released.

But as @x448 said, the performance penalty, especially for quick workflows, of 10s vs. 1s without setup-go is a quite big.

@tjanez
Copy link

tjanez commented Feb 25, 2020

Ouch, I just discovered that, e.g. Ubuntu 18.04 image, defaults to Go 1.12 (while also having Go 1.11 and Go 1.13 pre-installed) despite Go 1.13 being out since Sep 3, 2019.

Furthermore, all minor revisions of installed Go versions are out-dated:

  • Go 1.11 (installed version: 1.11.12, latest version: 1.11.13)
  • Go 1.12 (installed version: 1.12.7, latest version: 1.12.17)
  • Go 1.13 (installed version: 1.13, latest version: 1.13.8)

All never minor releases of the respective Go versions contain fixes for security vulnerabilities, so this is also a security issue.

So, currently, using setup-go is basically a necessity.

@x448
Copy link
Author

x448 commented Mar 22, 2020

@bryanmacfarlane on March 16, actions/virtual-environments released ubuntu image with latest version of each of the last 4 big releases of Go (1.11.x to 1.14.x).

It would be great if actions/setup-go can leverage this to eliminate the 10 second lag.

Ubuntu 1804 (20200316 update) released by actions/virtual-environments lists:

  • Go 1.11 (go version go1.11.13 linux/amd64)
  • Go 1.12 (go version go1.12.17 linux/amd64)
  • Go 1.13 (go version go1.13.8 linux/amd64)
  • Go 1.14 (go version go1.14 linux/amd64)

BTW, the release notes for Windows Server 2019 image (released on March 19) only mentions
Go 1.14.

@x448 x448 changed the title Too slow. Preinstall latest 2-3 releases of Go and update symlink (10s --> 1s optimization) Too slow. Use preinstalled 4 releases of Go in ubuntu-latest by updating symlink (10s --> 0.1s optimization) Mar 26, 2020
@bryanmacfarlane
Copy link
Member

The correct fix to cut out the 10s is for image gen to populate the cache with n - x latest versions.

@bryanmacfarlane bryanmacfarlane added the external Unexpected behavior was caused by external problems label Mar 27, 2020
@bryanmacfarlane bryanmacfarlane changed the title Too slow. Use preinstalled 4 releases of Go in ubuntu-latest by updating symlink (10s --> 0.1s optimization) Optimize by allowing latest versions installed to be used Mar 27, 2020
@ydnar
Copy link

ydnar commented Apr 1, 2020

A related issue: if you don’t specify go-version, can it just default to the latest version?

Currently, it silently short-circuits and doesn’t add $GOBIN to $PATH, which seems…wrong.

@bryanmacfarlane
Copy link
Member

bryanmacfarlane commented Apr 1, 2020

@ydnar if you don't specify a version it shouldn't install anything. The scenario is you want to use the existing go in the path but you want problem matchers installed and/or proxy configured etc..

See:
https://github.com/actions/setup-go/blob/master/src/main.ts#L13

If you give a version spec of something like 1.* or ^1.13 in the v2 lineage that will resolve to the latest of this major version.

@ydnar
Copy link

ydnar commented Apr 1, 2020

@ydnar if you don't specify a version it shouldn't install anything. The scenario is you want to use the existing go in the path but you want problem matchers installed and/or proxy configured etc..

See:
https://github.com/actions/setup-go/blob/master/src/main.ts#L13

If you give a version spec of something like 1.* or ^1.13 in the v2 lineage that will resolve to the latest of this major version.

That’s OK. Could it at least add $GOBIN to $PATH in addition to adding the matchers?

@bryanmacfarlane
Copy link
Member

@ydnar - can you log a separate issue for $GOBIN if version not specified? I think that's a good suggestion ... I'll also update docs to make that clearer.

@x448
Copy link
Author

x448 commented Apr 3, 2020

@bryanmacfarlane does the external label mean someone needs to file an issue in another project for this to be resolved?

@bryanmacfarlane
Copy link
Member

I need to create an issue in virtual-environments and chat with them

@maxim-lobanov
Copy link
Contributor

Hello,
Recently, some updates were done from images side and this task should switch pre-installed versions without latency.

@bryanmacfarlane
Copy link
Member

@x448 - I'm going to close since the latest versions are added to the image and should be resolved immediately with no downloads. You can also switch to the v2 version. Let us know if you have an issue.

@salarali
Copy link

v2 is still not using the cached data for me.
My action block:

      - name: Install Go 1.14.6
        uses: actions/setup-go@v2
        with:
          go-version: 1.14.6
        id: go

The output I always get:

Setup go stable version spec 1.14.6
Attempting to download 1.14.6...
matching 1.14.6...
Acquiring 1.14.6 from https://github.com/actions/go-versions/releases/download/1.14.6-20200717.1/go-1.14.6-linux-x64.tar.gz
Extracting Go...
/bin/tar xz --warning=no-unknown-keyword -C /home/runner/work/_temp/3dbcffcb-6d87-4c4c-8bd7-3c7b62a1f3c0 -f /home/runner/work/_temp/9d70aecc-d410-4a46-9ab1-9beb9d03b179
Successfully extracted go to /home/runner/work/_temp/3dbcffcb-6d87-4c4c-8bd7-3c7b62a1f3c0
Adding to the cache ...
Successfully cached go to /opt/hostedtoolcache/go/1.14.6/x64
Added go to the path
Successfully setup go version 1.14.6
go version go1.14.6 linux/amd64

Am I missing some config?

@maxim-lobanov
Copy link
Contributor

@salarali , your config is correct. Please pay attention that cached versions on image are updated with minor delay (1-2 weeks).

  • go1.14.5 (released 2020/07/14)
  • go1.14.6 (released 2020/07/16)
    But Image still caches 1.14.4

Image should be updated early next week and your builds will start to pickup new version from cache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external Unexpected behavior was caused by external problems
Projects
None yet
Development

No branches or pull requests

6 participants