Skip to content

Comments

Update microsoftvisualstudiocode.sh#1964

Merged
bartreardon merged 1 commit intoInstallomator:mainfrom
kernsb:microsoftvisualstudiocode-update
Feb 10, 2025
Merged

Update microsoftvisualstudiocode.sh#1964
bartreardon merged 1 commit intoInstallomator:mainfrom
kernsb:microsoftvisualstudiocode-update

Conversation

@kernsb
Copy link
Contributor

@kernsb kernsb commented Oct 17, 2024

Fixed:

  • appNewVersion was not getting set because the curl command was not being redirected properly without a User Agent header being supplied.

  • Download was failing. Moved the new version check to happen first, so that we could then use that version to construct the needed download URL.

Fixed:

- appNewVersion was not getting set because the curl command was not being redirected properly without a User Agent header being supplied.

- Download was failing. Moved the new version check to happen first, so that we could then use that version to construct the needed download URL.
@kernsb
Copy link
Contributor Author

kernsb commented Oct 17, 2024

Test run output:

sudo Installomator/utils/assemble.sh microsoftvisualstudiocode DEBUG=0 INSTALL=force
2024-10-17 13:27:24 : REQ : microsoftvisualstudiocode : ################## Start Installomator v. 10.7beta, date 2024-10-17
2024-10-17 13:27:24 : INFO : microsoftvisualstudiocode : ################## Version: 10.7beta
2024-10-17 13:27:24 : INFO : microsoftvisualstudiocode : ################## Date: 2024-10-17
2024-10-17 13:27:24 : INFO : microsoftvisualstudiocode : ################## microsoftvisualstudiocode
2024-10-17 13:27:24 : DEBUG : microsoftvisualstudiocode : DEBUG mode 1 enabled.
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : setting variable from argument DEBUG=0
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : setting variable from argument INSTALL=force
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : name=Visual Studio Code
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : appName=Visual Studio Code.app
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : type=zip
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : archiveName=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : downloadURL=https://update.code.visualstudio.com/1.94.2/darwin-universal/stable
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : curlOptions=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : appNewVersion=1.94.2
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : appCustomVersion function: Not defined
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : versionKey=CFBundleShortVersionString
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : packageID=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : pkgName=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : choiceChangesXML=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : expectedTeamID=UBF8T346G9
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : blockingProcesses=Code
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : installerTool=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : CLIInstaller=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : CLIArguments=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : updateTool=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : updateToolArguments=
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : updateToolRunAsCurrentUser=
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : BLOCKING_PROCESS_ACTION=tell_user
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : NOTIFY=success
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : LOGGING=DEBUG
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : LOGO=/System/Applications/App Store.app/Contents/Resources/AppIcon.icns
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : Label type: zip
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : archiveName: Visual Studio Code.zip
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : Changing directory to /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : App(s) found: /Applications/Visual Studio Code.app
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : found app at /Applications/Visual Studio Code.app, version 1.94.2, on versionKey CFBundleShortVersionString
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : appversion: 1.94.2
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : Label is not of type “updateronly”, and it’s set to use force to install or ignoring app store apps, so not using updateTool.
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : Latest version of Visual Studio Code is 1.94.2
2024-10-17 13:27:25 : INFO : microsoftvisualstudiocode : There is no newer version available.
2024-10-17 13:27:25 : REQ : microsoftvisualstudiocode : Downloading https://update.code.visualstudio.com/1.94.2/darwin-universal/stable to Visual Studio Code.zip
2024-10-17 13:27:25 : DEBUG : microsoftvisualstudiocode : No Dialog connection, just download
2024-10-17 13:29:35 : DEBUG : microsoftvisualstudiocode : File list: -rw-r--r-- 1 root wheel 215M Oct 17 13:29 Visual Studio Code.zip
2024-10-17 13:29:35 : DEBUG : microsoftvisualstudiocode : File type: Visual Studio Code.zip: Zip archive data, at least v1.0 to extract, compression method=store
2024-10-17 13:29:35 : DEBUG : microsoftvisualstudiocode : curl output was:

  • Host update.code.visualstudio.com:443 was resolved.
  • IPv6: (none)
  • IPv4: 13.107.246.51
  • Trying 13.107.246.51:443...
  • Connected to update.code.visualstudio.com (13.107.246.51) port 443
  • ALPN: curl offers h2,http/1.1
  • (304) (OUT), TLS handshake, Client hello (1):
    } [333 bytes data]
  • CAfile: /etc/ssl/cert.pem
  • CApath: none
  • (304) (IN), TLS handshake, Server hello (2):
    { [88 bytes data]
  • (304) (OUT), TLS handshake, Client hello (1):
    } [366 bytes data]
  • (304) (IN), TLS handshake, Server hello (2):
    { [155 bytes data]
  • (304) (IN), TLS handshake, Unknown (8):
    { [19 bytes data]
  • (304) (IN), TLS handshake, Certificate (11):
    { [4572 bytes data]
  • (304) (IN), TLS handshake, CERT verify (15):
    { [264 bytes data]
  • (304) (IN), TLS handshake, Finished (20):
    { [52 bytes data]
  • (304) (OUT), TLS handshake, Finished (20):
    } [52 bytes data]
  • SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF
  • ALPN: server accepted h2
  • Server certificate:
  • subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=update.code.visualstudio.com
  • start date: Aug 9 18:38:55 2024 GMT
  • expire date: Feb 5 18:38:55 2025 GMT
  • subjectAltName: host "update.code.visualstudio.com" matched cert's "update.code.visualstudio.com"
  • issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 08
  • SSL certificate verify ok.
  • using HTTP/2
  • [HTTP/2] [1] OPENED stream for https://update.code.visualstudio.com/1.94.2/darwin-universal/stable
  • [HTTP/2] [1] [:method: GET]
  • [HTTP/2] [1] [:scheme: https]
  • [HTTP/2] [1] [:authority: update.code.visualstudio.com]
  • [HTTP/2] [1] [:path: /1.94.2/darwin-universal/stable]
  • [HTTP/2] [1] [user-agent: curl/8.7.1]
  • [HTTP/2] [1] [accept: /]

GET /1.94.2/darwin-universal/stable HTTP/2
Host: update.code.visualstudio.com
User-Agent: curl/8.7.1
Accept: /

  • Request completely sent off
    < HTTP/2 302
    < date: Thu, 17 Oct 2024 17:27:25 GMT
    < content-type: text/plain; charset=utf-8
    < content-length: 157
    < access-control-allow-origin: *
    < cache-control: max-age=150
    < location: https://vscode.download.prss.microsoft.com/dbazure/download/stable/384ff7382de624fb94dbaf6da11977bba1ecd427/VSCode-darwin-universal.zip
    < vary: Accept
    < request-context: appId=cid-v1:8109e553-6232-492a-afca-b78cea9b431c
    < x-powered-by: Express
    < x-content-type-options: nosniff
    < x-source-commit: 08c40a630cbc27e6dec48081ba4d32c45f685ee1
    < x-sha256: fc364cc7f2ac02288427dd12e2adb188c7eed2cdf94c7e2e1b7812125952a399
    < x-azure-ref: 20241017T172725Z-165d54949d656sb515v913mw3g000000091g00000000c5vc
    < x-cache: CONFIG_NOCACHE
    <
  • Ignoring the response-body
  • Connection #0 to host update.code.visualstudio.com left intact
  • Issue another request to this URL: 'https://vscode.download.prss.microsoft.com/dbazure/download/stable/384ff7382de624fb94dbaf6da11977bba1ecd427/VSCode-darwin-universal.zip'
  • Host vscode.download.prss.microsoft.com:443 was resolved.
  • IPv6: (none)
  • IPv4: 199.232.214.172, 199.232.210.172
  • Trying 199.232.214.172:443...
  • Connected to vscode.download.prss.microsoft.com (199.232.214.172) port 443
  • ALPN: curl offers h2,http/1.1
  • (304) (OUT), TLS handshake, Client hello (1):
    } [339 bytes data]
  • (304) (IN), TLS handshake, Server hello (2):
    { [122 bytes data]
  • (304) (IN), TLS handshake, Unknown (8):
    { [25 bytes data]
  • (304) (IN), TLS handshake, Certificate (11):
    { [3799 bytes data]
  • (304) (IN), TLS handshake, CERT verify (15):
    { [264 bytes data]
  • (304) (IN), TLS handshake, Finished (20):
    { [36 bytes data]
  • (304) (OUT), TLS handshake, Finished (20):
    } [36 bytes data]
  • SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 / [blank] / UNDEF
  • ALPN: server accepted http/1.1
  • Server certificate:
  • subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=fs.download.prss.microsoft.com
  • start date: Aug 22 20:43:37 2024 GMT
  • expire date: Feb 18 20:43:37 2025 GMT
  • subjectAltName: host "vscode.download.prss.microsoft.com" matched cert's "*.download.prss.microsoft.com"
  • issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 03
  • SSL certificate verify ok.
  • using HTTP/1.x

GET /dbazure/download/stable/384ff7382de624fb94dbaf6da11977bba1ecd427/VSCode-darwin-universal.zip HTTP/1.1
Host: vscode.download.prss.microsoft.com
User-Agent: curl/8.7.1
Accept: /

  • Request completely sent off
    < HTTP/1.1 200 OK
    < Connection: keep-alive
    < Content-Length: 225850129
    < Cache-Control: public, max-age=86400
    < Content-Disposition: attachment; filename=VSCode-darwin-universal.zip; filename*=UTF-8''VSCode-darwin-universal.zip
    < Content-Type: application/octet-stream
    < Etag: "0x8D8887321A6C7A0D8457A86B20F51F8310F6B30583B9224B17B0A3E82FAF2168"
    < Last-Modified: Wed, 09 Oct 2024 17:52:02 GMT
    < X-Ms-ApiVersion: Distribute 1.2
    < X-Ms-Region: prod-eus2-z1
    < Accept-Ranges: bytes
    < Date: Thu, 17 Oct 2024 17:27:26 GMT
    < Via: 1.1 varnish
    < Age: 10863
    < X-Served-By: cache-chi-kigq8000077-CHI
    < X-Cache: HIT
    < X-Cache-Hits: 2
    < X-Timer: S1729186046.098092,VS0,VE0
    < X-CID: 3
    < X-CCC: US
    <
    { [16384 bytes data]
  • Connection What if the user is already running the latest version? #1 to host vscode.download.prss.microsoft.com left intact

2024-10-17 13:29:35 : REQ : microsoftvisualstudiocode : no more blocking processes, continue with update
2024-10-17 13:29:35 : REQ : microsoftvisualstudiocode : Installing Visual Studio Code
2024-10-17 13:29:35 : INFO : microsoftvisualstudiocode : Unzipping Visual Studio Code.zip
2024-10-17 13:29:37 : INFO : microsoftvisualstudiocode : Verifying: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C/Visual Studio Code.app
2024-10-17 13:29:37 : DEBUG : microsoftvisualstudiocode : App size: 560M /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C/Visual Studio Code.app
2024-10-17 13:29:42 : DEBUG : microsoftvisualstudiocode : Debugging enabled, App Verification output was:
/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C/Visual Studio Code.app: accepted
source=Notarized Developer ID
origin=Developer ID Application: Microsoft Corporation (UBF8T346G9)

2024-10-17 13:29:42 : INFO : microsoftvisualstudiocode : Team ID matching: UBF8T346G9 (expected: UBF8T346G9 )
2024-10-17 13:29:42 : INFO : microsoftvisualstudiocode : Downloaded version of Visual Studio Code is 1.94.2 on versionKey CFBundleShortVersionString, same as installed.
2024-10-17 13:29:42 : INFO : microsoftvisualstudiocode : Using force to install anyway.
2024-10-17 13:29:42 : INFO : microsoftvisualstudiocode : App has LSMinimumSystemVersion: 10.15
2024-10-17 13:29:42 : WARN : microsoftvisualstudiocode : Removing existing /Applications/Visual Studio Code.app
2024-10-17 13:29:42 : DEBUG : microsoftvisualstudiocode : Debugging enabled, App removing output was:
/Applications/Visual Studio Code.app/Contents/
Last Log repeated 2847 times
/Applications/Visual Studio Code.app/Contents
/Applications/Visual Studio Code.app

2024-10-17 13:29:42 : INFO : microsoftvisualstudiocode : Copy /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C/Visual Studio Code.app to /Applications
2024-10-17 13:29:44 : DEBUG : microsoftvisualstudiocode : Debugging enabled, App copy output was:
Copying /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C/Visual Studio Code.app

2024-10-17 13:29:44 : WARN : microsoftvisualstudiocode : Changing owner to bkerns
2024-10-17 13:29:44 : INFO : microsoftvisualstudiocode : Finishing...
2024-10-17 13:29:47 : INFO : microsoftvisualstudiocode : App(s) found: /Applications/Visual Studio Code.app
2024-10-17 13:29:47 : INFO : microsoftvisualstudiocode : found app at /Applications/Visual Studio Code.app, version 1.94.2, on versionKey CFBundleShortVersionString
2024-10-17 13:29:47 : REQ : microsoftvisualstudiocode : Installed Visual Studio Code, version 1.94.2
2024-10-17 13:29:47 : INFO : microsoftvisualstudiocode : notifying
2024-10-17 13:29:47 : DEBUG : microsoftvisualstudiocode : Deleting /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/tmp.EEf6Wfdh0C
2024-10-17 13:29:48 : DEBUG : microsoftvisualstudiocode : Debugging enabled, Deleting tmpDir output was:
...
2024-10-17 13:30:03 : INFO : microsoftvisualstudiocode : Installomator did not close any apps, so no need to reopen any apps.
2024-10-17 13:30:03 : REQ : microsoftvisualstudiocode : All done!
2024-10-17 13:30:03 : REQ : microsoftvisualstudiocode : ################## End Installomator, exit code 0

@gilburns
Copy link
Contributor

gilburns commented Oct 18, 2024

It might simplify the code if you were to use the same json update feed that the VSC app uses?

https://update.code.visualstudio.com/api/update/darwin-universal/stable/6261075646f055b99068d3688932416f2346dd3b

Returns this:
{"url":"https://vscode.download.prss.microsoft.com/dbazure/download/stable/384ff7382de624fb94dbaf6da11977bba1ecd427/VSCode-darwin-universal.zip","name":"1.94.2","version":"384ff7382de624fb94dbaf6da11977bba1ecd427","productVersion":"1.94.2","hash":"135f7595c2e7c57efbf7fe420c4fb59059109cab","timestamp":1728490348579,"sha256hash":"fc364cc7f2ac02288427dd12e2adb188c7eed2cdf94c7e2e1b7812125952a399","supportsFastUpdate":true}

The value "6261075646f055b99068d3688932416f2346dd3b" at the end of the URL represents the git commit for the VSC app build that is checking for updates. That value above is the commit for version 1.73.1 from October 2022

The commit is visible in the About panel and can also be found in multiple files in the app bundle.
VSC About

@kernsb
Copy link
Contributor Author

kernsb commented Oct 18, 2024

I'm sure that is a possibility and would be worth look into in the future. In this case, I was proposing a fix that was as similar as possible to what was already being done in the original.

@bartreardon bartreardon added application adds or improves an application label validated App label that has been validated by the validation bot labels Feb 7, 2025
@bartreardon
Copy link
Collaborator

🤖 Validation robot 🤖
File fragments/labels/microsoftvisualstudiocode.sh
** Label info:
├ ✅ correct line ending
├ ✅ Name: Visual Studio Code
├ ✅ Type: zip
├ ✅ Expected Team: UBF8T346G9
├ ✅ App New Version: 1.97.0
└ Download URL: https://update.code.visualstudio.com/1.97.0/darwin-universal/stable
├ ✅ URL is reachable
└ ✅ Download Size: 221.2 MB
✅ All checks passed


@bartreardon bartreardon added this to the v10.8 milestone Feb 7, 2025
@bartreardon
Copy link
Collaborator

Thank you!

@bartreardon bartreardon merged commit c1aaf3a into Installomator:main Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

application adds or improves an application label validated App label that has been validated by the validation bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants