tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

`tfenv list-remote` doesn't have the versions sorted when using `TFENV_REMOTE` with Artifactory

Open samuel-phan opened this issue 1 year ago • 2 comments

When setting up the TFENV_REMOTE to a private Artifactory mirror:

$ TFENV_REMOTE=https://example.jfrog.io/artifactory/hashicorp

tfenv list-remote doesn't show the versions in the right order:

❯ tfenv list-remote
0.1.0
0.1.1
0.10.0
0.10.1
...
0.10.8
0.11.0
0.11.1
0.11.10
0.11.11
0.11.12
0.11.13
0.11.14
0.11.15
0.11.2
0.11.3
0.11.4
0.11.5
0.11.6
0.11.7
0.11.8
0.11.9
0.12.0
...
0.15.3
0.15.4
0.15.5
0.2.0
0.2.1
0.2.2
0.3.0
0.3.1
0.3.5
0.3.6
0.3.7
...
1.4.5
1.4.6
1.5.0
7.38.7

The Artifactory HTML page can look like this:

Artifactory HTML page
<!DOCTYPE html>
<html>
<head><meta name="robots" content="noindex" />
<title>Index of hashicorp/terraform</title>
</head>
<body>
<h1>Index of hashicorp/terraform</h1>
<pre>Name     Last modified      Size</pre><hr/>
<pre><a href="../">../</a>
<a href="0.1.0/">0.1.0/</a>    15-Jun-2023 16:35    -
<a href="0.1.1/">0.1.1/</a>    15-Jun-2023 16:34    -
<a href="0.10.0/">0.10.0/</a>   15-Jun-2023 15:41    -
<a href="0.10.1/">0.10.1/</a>   15-Jun-2023 15:41    -
<a href="0.10.2/">0.10.2/</a>   15-Jun-2023 15:40    -
<a href="0.10.3/">0.10.3/</a>   15-Jun-2023 15:40    -
<a href="0.10.4/">0.10.4/</a>   15-Jun-2023 15:40    -
<a href="0.10.5/">0.10.5/</a>   15-Jun-2023 15:39    -
<a href="0.10.6/">0.10.6/</a>   15-Jun-2023 15:39    -
<a href="0.10.7/">0.10.7/</a>   15-Jun-2023 15:39    -
<a href="0.10.8/">0.10.8/</a>   15-Jun-2023 15:38    -
<a href="0.11.0/">0.11.0/</a>   15-Jun-2023 15:38    -
<a href="0.11.1/">0.11.1/</a>   15-Jun-2023 15:38    -
<a href="0.11.10/">0.11.10/</a>  15-Jun-2023 15:35    -
<a href="0.11.11/">0.11.11/</a>  15-Jun-2023 15:34    -
<a href="0.11.12/">0.11.12/</a>  15-Jun-2023 15:34    -
<a href="0.11.13/">0.11.13/</a>  15-Jun-2023 15:33    -
<a href="0.11.14/">0.11.14/</a>  15-Jun-2023 15:33    -
<a href="0.11.15/">0.11.15/</a>  15-Jun-2023 15:33    -
<a href="0.11.2/">0.11.2/</a>   15-Jun-2023 15:37    -
<a href="0.11.3/">0.11.3/</a>   15-Jun-2023 15:37    -
<a href="0.11.4/">0.11.4/</a>   15-Jun-2023 15:37    -
<a href="0.11.5/">0.11.5/</a>   15-Jun-2023 15:36    -
<a href="0.11.6/">0.11.6/</a>   15-Jun-2023 15:36    -
<a href="0.11.7/">0.11.7/</a>   15-Jun-2023 15:36    -
<a href="0.11.8/">0.11.8/</a>   15-Jun-2023 15:35    -
<a href="0.11.9/">0.11.9/</a>   15-Jun-2023 15:35    -
<a href="0.12.0/">0.12.0/</a>   15-Jun-2023 15:32    -
<a href="0.12.1/">0.12.1/</a>   15-Jun-2023 15:32    -
<a href="0.12.10/">0.12.10/</a>  15-Jun-2023 15:29    -
<a href="0.12.11/">0.12.11/</a>  15-Jun-2023 15:29    -
<a href="0.12.12/">0.12.12/</a>  15-Jun-2023 15:28    -
<a href="0.12.13/">0.12.13/</a>  15-Jun-2023 15:28    -
<a href="0.12.14/">0.12.14/</a>  15-Jun-2023 15:28    -
<a href="0.12.15/">0.12.15/</a>  15-Jun-2023 15:27    -
<a href="0.12.16/">0.12.16/</a>  15-Jun-2023 15:27    -
<a href="0.12.17/">0.12.17/</a>  15-Jun-2023 15:27    -
<a href="0.12.18/">0.12.18/</a>  15-Jun-2023 15:26    -
<a href="0.12.19/">0.12.19/</a>  15-Jun-2023 15:26    -
<a href="0.12.2/">0.12.2/</a>   15-Jun-2023 15:32    -
<a href="0.12.20/">0.12.20/</a>  15-Jun-2023 15:25    -
<a href="0.12.21/">0.12.21/</a>  15-Jun-2023 15:25    -
<a href="0.12.22/">0.12.22/</a>  15-Jun-2023 15:25    -
<a href="0.12.23/">0.12.23/</a>  15-Jun-2023 15:24    -
<a href="0.12.24/">0.12.24/</a>  15-Jun-2023 15:24    -
<a href="0.12.25/">0.12.25/</a>  15-Jun-2023 15:24    -
<a href="0.12.26/">0.12.26/</a>  15-Jun-2023 15:23    -
<a href="0.12.27/">0.12.27/</a>  15-Jun-2023 15:23    -
<a href="0.12.28/">0.12.28/</a>  15-Jun-2023 15:22    -
<a href="0.12.29/">0.12.29/</a>  15-Jun-2023 15:22    -
<a href="0.12.3/">0.12.3/</a>   15-Jun-2023 15:31    -
<a href="0.12.30/">0.12.30/</a>  15-Jun-2023 15:21    -
<a href="0.12.31/">0.12.31/</a>  15-Jun-2023 15:20    -
<a href="0.12.4/">0.12.4/</a>   15-Jun-2023 15:31    -
<a href="0.12.5/">0.12.5/</a>   15-Jun-2023 15:31    -
<a href="0.12.6/">0.12.6/</a>   15-Jun-2023 15:30    -
<a href="0.12.7/">0.12.7/</a>   15-Jun-2023 15:30    -
<a href="0.12.8/">0.12.8/</a>   15-Jun-2023 15:30    -
<a href="0.12.9/">0.12.9/</a>   15-Jun-2023 15:29    -
<a href="0.13.0/">0.13.0/</a>   15-Jun-2023 15:19    -
<a href="0.13.1/">0.13.1/</a>   15-Jun-2023 15:18    -
<a href="0.13.2/">0.13.2/</a>   15-Jun-2023 15:17    -
<a href="0.13.3/">0.13.3/</a>   15-Jun-2023 15:16    -
<a href="0.13.4/">0.13.4/</a>   15-Jun-2023 15:15    -
<a href="0.13.5/">0.13.5/</a>   15-Jun-2023 15:14    -
<a href="0.13.6/">0.13.6/</a>   15-Jun-2023 15:12    -
<a href="0.13.7/">0.13.7/</a>   15-Jun-2023 15:11    -
<a href="0.14.0/">0.14.0/</a>   15-Jun-2023 15:10    -
<a href="0.14.1/">0.14.1/</a>   15-Jun-2023 15:08    -
<a href="0.14.10/">0.14.10/</a>  15-Jun-2023 14:57    -
<a href="0.14.11/">0.14.11/</a>  15-Jun-2023 14:56    -
<a href="0.14.2/">0.14.2/</a>   15-Jun-2023 15:07    -
<a href="0.14.3/">0.14.3/</a>   15-Jun-2023 15:06    -
<a href="0.14.4/">0.14.4/</a>   15-Jun-2023 15:05    -
<a href="0.14.5/">0.14.5/</a>   15-Jun-2023 15:04    -
<a href="0.14.6/">0.14.6/</a>   15-Jun-2023 15:03    -
<a href="0.14.7/">0.14.7/</a>   15-Jun-2023 15:01    -
<a href="0.14.8/">0.14.8/</a>   15-Jun-2023 15:00    -
<a href="0.14.9/">0.14.9/</a>   15-Jun-2023 14:59    -
<a href="0.15.0/">0.15.0/</a>   15-Jun-2023 14:55    -
<a href="0.15.1/">0.15.1/</a>   15-Jun-2023 14:54    -
<a href="0.15.2/">0.15.2/</a>   15-Jun-2023 14:53    -
<a href="0.15.3/">0.15.3/</a>   15-Jun-2023 14:52    -
<a href="0.15.4/">0.15.4/</a>   15-Jun-2023 14:50    -
<a href="0.15.5/">0.15.5/</a>   15-Jun-2023 14:49    -
<a href="0.2.0/">0.2.0/</a>    15-Jun-2023 16:34    -
<a href="0.2.1/">0.2.1/</a>    15-Jun-2023 16:34    -
<a href="0.2.2/">0.2.2/</a>    15-Jun-2023 16:33    -
<a href="0.3.0/">0.3.0/</a>    15-Jun-2023 16:33    -
<a href="0.3.1/">0.3.1/</a>    15-Jun-2023 16:32    -
<a href="0.3.5/">0.3.5/</a>    15-Jun-2023 16:32    -
<a href="0.3.6/">0.3.6/</a>    15-Jun-2023 16:31    -
<a href="0.3.7/">0.3.7/</a>    15-Jun-2023 16:30    -
<a href="0.4.0/">0.4.0/</a>    15-Jun-2023 16:30    -
<a href="0.4.1/">0.4.1/</a>    15-Jun-2023 16:29    -
<a href="0.4.2/">0.4.2/</a>    15-Jun-2023 16:28    -
<a href="0.5.0/">0.5.0/</a>    15-Jun-2023 16:28    -
<a href="0.5.1/">0.5.1/</a>    15-Jun-2023 16:27    -
<a href="0.5.3/">0.5.3/</a>    07-Jun-2023 16:34    -
<a href="0.6.0/">0.6.0/</a>    15-Jun-2023 16:25    -
<a href="0.6.1/">0.6.1/</a>    15-Jun-2023 16:24    -
<a href="0.6.10/">0.6.10/</a>   15-Jun-2023 16:14    -
<a href="0.6.11/">0.6.11/</a>   15-Jun-2023 16:12    -
<a href="0.6.12/">0.6.12/</a>   15-Jun-2023 16:11    -
<a href="0.6.13/">0.6.13/</a>   15-Jun-2023 16:09    -
<a href="0.6.14/">0.6.14/</a>   15-Jun-2023 16:07    -
<a href="0.6.15/">0.6.15/</a>   15-Jun-2023 16:05    -
<a href="0.6.16/">0.6.16/</a>   15-Jun-2023 16:03    -
<a href="0.6.2/">0.6.2/</a>    15-Jun-2023 16:24    -
<a href="0.6.3/">0.6.3/</a>    15-Jun-2023 16:23    -
<a href="0.6.4/">0.6.4/</a>    15-Jun-2023 16:22    -
<a href="0.6.5/">0.6.5/</a>    15-Jun-2023 16:21    -
<a href="0.6.6/">0.6.6/</a>    15-Jun-2023 16:20    -
<a href="0.6.7/">0.6.7/</a>    15-Jun-2023 16:18    -
<a href="0.6.8/">0.6.8/</a>    15-Jun-2023 16:17    -
<a href="0.6.9/">0.6.9/</a>    15-Jun-2023 16:15    -
<a href="0.7.0/">0.7.0/</a>    15-Jun-2023 16:03    -
<a href="0.7.1/">0.7.1/</a>    15-Jun-2023 16:03    -
<a href="0.7.10/">0.7.10/</a>   15-Jun-2023 15:58    -
<a href="0.7.11/">0.7.11/</a>   15-Jun-2023 15:57    -
<a href="0.7.12/">0.7.12/</a>   15-Jun-2023 15:57    -
<a href="0.7.13/">0.7.13/</a>   15-Jun-2023 15:56    -
<a href="0.7.2/">0.7.2/</a>    15-Jun-2023 16:02    -
<a href="0.7.3/">0.7.3/</a>    15-Jun-2023 16:02    -
<a href="0.7.4/">0.7.4/</a>    15-Jun-2023 16:01    -
<a href="0.7.5/">0.7.5/</a>    15-Jun-2023 16:01    -
<a href="0.7.6/">0.7.6/</a>    15-Jun-2023 16:00    -
<a href="0.7.7/">0.7.7/</a>    15-Jun-2023 16:00    -
<a href="0.7.8/">0.7.8/</a>    15-Jun-2023 15:59    -
<a href="0.7.9/">0.7.9/</a>    15-Jun-2023 15:59    -
<a href="0.8.0/">0.8.0/</a>    15-Jun-2023 15:55    -
<a href="0.8.1/">0.8.1/</a>    15-Jun-2023 15:55    -
<a href="0.8.2/">0.8.2/</a>    15-Jun-2023 15:54    -
<a href="0.8.3/">0.8.3/</a>    15-Jun-2023 15:54    -
<a href="0.8.4/">0.8.4/</a>    15-Jun-2023 15:53    -
<a href="0.8.5/">0.8.5/</a>    15-Jun-2023 15:52    -
<a href="0.8.6/">0.8.6/</a>    15-Jun-2023 15:52    -
<a href="0.8.7/">0.8.7/</a>    15-Jun-2023 15:51    -
<a href="0.8.8/">0.8.8/</a>    15-Jun-2023 15:50    -
<a href="0.9.0/">0.9.0/</a>    15-Jun-2023 15:49    -
<a href="0.9.1/">0.9.1/</a>    15-Jun-2023 15:48    -
<a href="0.9.10/">0.9.10/</a>   15-Jun-2023 15:42    -
<a href="0.9.11/">0.9.11/</a>   15-Jun-2023 15:41    -
<a href="0.9.2/">0.9.2/</a>    15-Jun-2023 15:48    -
<a href="0.9.3/">0.9.3/</a>    15-Jun-2023 15:47    -
<a href="0.9.4/">0.9.4/</a>    15-Jun-2023 15:46    -
<a href="0.9.5/">0.9.5/</a>    15-Jun-2023 15:45    -
<a href="0.9.6/">0.9.6/</a>    15-Jun-2023 15:44    -
<a href="0.9.7/">0.9.7/</a>    15-Jun-2023 15:43    -
<a href="0.9.8/">0.9.8/</a>    15-Jun-2023 15:43    -
<a href="0.9.9/">0.9.9/</a>    15-Jun-2023 15:42    -
<a href="1.0.0/">1.0.0/</a>    15-Jun-2023 14:48    -
<a href="1.0.1/">1.0.1/</a>    15-Jun-2023 14:47    -
<a href="1.0.10/">1.0.10/</a>   15-Jun-2023 14:40    -
<a href="1.0.11/">1.0.11/</a>   15-Jun-2023 13:49    -
<a href="1.0.2/">1.0.2/</a>    15-Jun-2023 13:50    -
<a href="1.0.3/">1.0.3/</a>    15-Jun-2023 14:46    -
<a href="1.0.4/">1.0.4/</a>    15-Jun-2023 14:45    -
<a href="1.0.5/">1.0.5/</a>    15-Jun-2023 14:44    -
<a href="1.0.6/">1.0.6/</a>    15-Jun-2023 14:43    -
<a href="1.0.7/">1.0.7/</a>    15-Jun-2023 14:42    -
<a href="1.0.8/">1.0.8/</a>    15-Jun-2023 14:41    -
<a href="1.0.9/">1.0.9/</a>    15-Jun-2023 14:40    -
<a href="1.1.0/">1.1.0/</a>    15-Jun-2023 14:38    -
<a href="1.1.1/">1.1.1/</a>    15-Jun-2023 14:37    -
<a href="1.1.2/">1.1.2/</a>    15-Jun-2023 14:37    -
<a href="1.1.3/">1.1.3/</a>    15-Jun-2023 14:36    -
<a href="1.1.4/">1.1.4/</a>    15-Jun-2023 14:35    -
<a href="1.1.5/">1.1.5/</a>    15-Jun-2023 14:35    -
<a href="1.1.6/">1.1.6/</a>    15-Jun-2023 14:34    -
<a href="1.1.7/">1.1.7/</a>    24-Mar-2022 17:02    -
<a href="1.1.8/">1.1.8/</a>    22-Apr-2022 15:25    -
<a href="1.1.9/">1.1.9/</a>    22-Apr-2022 15:26    -
<a href="1.2.0/">1.2.0/</a>    19-May-2022 11:20    -
<a href="1.2.1/">1.2.1/</a>    24-May-2022 13:36    -
<a href="1.2.2/">1.2.2/</a>    13-Jun-2022 08:19    -
<a href="1.2.3/">1.2.3/</a>    17-Jun-2022 15:57    -
<a href="1.2.4/">1.2.4/</a>    29-Jun-2022 23:00    -
<a href="1.2.5/">1.2.5/</a>    13-Jul-2022 23:58    -
<a href="1.2.6/">1.2.6/</a>    28-Jul-2022 18:30    -
<a href="1.2.7/">1.2.7/</a>    17-Aug-2022 10:24    -
<a href="1.2.8/">1.2.8/</a>    24-Aug-2022 15:37    -
<a href="1.2.9/">1.2.9/</a>    10-Sep-2022 01:24    -
<a href="1.3.0/">1.3.0/</a>    21-Sep-2022 16:21    -
<a href="1.3.1/">1.3.1/</a>    28-Sep-2022 23:35    -
<a href="1.3.2/">1.3.2/</a>    07-Oct-2022 00:17    -
<a href="1.3.3/">1.3.3/</a>    19-Oct-2022 20:27    -
<a href="1.3.4/">1.3.4/</a>    02-Nov-2022 18:35    -
<a href="1.3.5/">1.3.5/</a>    19-Nov-2022 00:55    -
<a href="1.3.6/">1.3.6/</a>    30-Nov-2022 22:16    -
<a href="1.3.7/">1.3.7/</a>    04-Jan-2023 16:27    -
<a href="1.3.8/">1.3.8/</a>    10-Feb-2023 01:21    -
<a href="1.3.9/">1.3.9/</a>    16-Feb-2023 14:44    -
<a href="1.4.0/">1.4.0/</a>    08-Mar-2023 21:36    -
<a href="1.4.1/">1.4.1/</a>    15-Mar-2023 15:43    -
<a href="1.4.2/">1.4.2/</a>    16-Mar-2023 14:31    -
<a href="1.4.3/">1.4.3/</a>    30-Mar-2023 17:40    -
<a href="1.4.4/">1.4.4/</a>    30-Mar-2023 22:02    -
<a href="1.4.5/">1.4.5/</a>    14-Apr-2023 17:40    -
<a href="1.4.6/">1.4.6/</a>    27-Apr-2023 11:24    -
<a href="1.5.0/">1.5.0/</a>    12-Jun-2023 11:38    -
</pre>
<hr/><address style="font-size:small;">Artifactory/7.38.7 Server at XXX Port 8081</address></body></html>

This is because the versions are naively sorted alphabetically by Artifactory.

Since tfenv considers that the latest version is the first entry, we could end up with something like this:

1.5.9
1.5.8
1.5.7
1.5.6
1.5.5
1.5.4
1.5.3
1.5.2
1.5.11
1.5.10
1.5.1
1.5.0

tfenv install latest would pickup the version 1.5.9 instead of 1.5.11.

samuel-phan avatar Jun 15 '23 17:06 samuel-phan

@samuel-phan can you share how you set up the Artifactory repository for tfenv? Thanks

ewanoomen avatar Oct 10 '23 13:10 ewanoomen

Sorry, I can't because I don't know how it's configured in my company. We have a dedicated team for Artifactory. I'm just a user of it.

samuel-phan avatar Oct 10 '23 23:10 samuel-phan