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

(mysql) Fix automatic MySQL update #250

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ArtskydJ
Copy link

@ArtskydJ ArtskydJ commented Jul 3, 2024

Description

I changed the mysql update.ps1 script to be similar to the mysql.workbench update.ps1 script. The big difference is that I had to filter out "mysql-cluster-[VERSION]" tags, and figure out the CDN URL.

Motivation and Context

Fixes #249

How Has this Been Tested?

I ran powershell .\update.ps1 and it found the latest (mysql 9.0.0)

Screenshot (if appropriate, usually isn't needed):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Migrated package (a package has been migrated from another repository)

Checklist:

  • My code follows the code style of this repository.
  • My change requires a change to documentation (this usually means the notes in the description of a package).
  • I have updated the documentation accordingly (this usually means the notes in the description of a package).
  • I have updated the package description and it is less than 4000 characters.
  • All files are up to date with the latest Contributing Guidelines
  • The added/modified package passed install/uninstall in the chocolatey test environment.
  • The changes only affect a single package (not including meta package).

@AppVeyorBot
Copy link

❌ Package verification failed, please review the Appveyor Logs and the provided Artifacts before requesting a human reviewer to take a look.

Changed indentation to 2 spaces because that's what it's set to in the .editorconfig
Changed charset to utf-8-bom because that's what it's set to in the .editorconfig
Removed a few extraneous newlines
Fixed alignment on lines 12 and 13
@AppVeyorBot
Copy link

❌ Package verification failed, please review the Appveyor Logs and the provided Artifacts before requesting a human reviewer to take a look.

$url = 'https://dev.mysql.com/get/Downloads/MySQL-' + $versiondata.toString(2) + '/mysql-' + $version + '-winx64.zip'
$Latest = @{ URL64 = $url; Version = $version }
return $Latest
$url = 'https://cdn.mysql.com/Downloads/MySQL-' + $versiondata.toString(2) + '/mysql-' + $version + '-winx64.msi'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching from ZIP installer to MSI would imply changes to the package's internal work. This is not desirable as this has been and always will be a portable package.

In the past, the MSI file was there and went away and came back and that 100 times over. To keep this package on track, the Windows ZIP fille should still be used, if available.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ZIP file is available. Switching to MSI was sloppy on my part, when I copy/pasted from mysql.workbench.

2a49231

Comment on lines 21 to 23
if (Test-Path Env:\github_api_key) {
$headers.Authorization = "token " + $env:github_api_key
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub api key should always be required. If not available, this package should not be able to be updated.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to require the env var.

2a49231

@AppVeyorBot
Copy link

❌ Package verification failed, please review the Appveyor Logs and the provided Artifacts before requesting a human reviewer to take a look.

@ArtskydJ
Copy link
Author

ArtskydJ commented Jul 4, 2024

I re-ran update.ps1, and it appears to be working on my machine.

C:\Users\Joseph\Github\chocolatey-packages\automatic\mysql>powershell .\update.ps1
mysql - checking updates using Chocolatey-AU version 1.0.0

URL check
  https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-9.0.0-winx64.zip
nuspec version: 8.0.31
remote version: 9.0.0
New version is available
Automatic checksum started
Adding 'C:\tools\mysql\current\bin' to the path and the current shell path
Downloading chocolatey\mysql 64 bit
  from 'https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-9.0.0-winx64.zip'

Download of mysql-9.0.0-winx64.zip (284.49 MB) completed.
Package downloaded and hash calculated for 64 bit version
Setting package description from README.md
Updating files
  $Latest data:
    Checksum64                (String)     78434ad24eca3b6717322446bb5ff0cf3cd8cb223c4e22adb2c67f7a416b6743
    ChecksumType64            (String)     sha256
    FileType                  (String)     zip
    NuspecVersion             (String)     8.0.31
    PackageName               (String)     mysql
    URL64                     (String)     https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-9.0.0-winx64.zip
    Version                   (String)     9.0.0
  mysql.nuspec
    setting id: mysql
    updating version: 8.0.31 -> 9.0.0
  tools\chocolateyInstall.ps1
    (^[$]checksumType\s*=\s*)('.*')     = $1'sha256'
    (^[$]url\s*=\s*)('.*')              = $1'https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-9.0.0-winx64.zip'
    (^[$]checksum\s*=\s*)('.*')         = $1'78434ad24eca3b6717322446bb5ff0cf3cd8cb223c4e22adb2c67f7a416b6743'
Attempting to build package from 'mysql.nuspec'.
Successfully created package 'C:\Users\Joseph\Github\chocolatey-packages\automatic\mysql\mysql.9.0.0.nupkg'

Package updated


Path          : C:\Users\Joseph\Github\chocolatey-packages\automatic\mysql
Name          : mysql
Updated       : True
Pushed        : False
RemoteVersion : 9.0.0
NuspecVersion : 8.0.31
Result        : {mysql - checking updates using Chocolatey-AU version 1.0.0, , URL check,
                https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-9.0.0-winx64.zip...}
Error         :
NuspecPath    : C:\Users\Joseph\Github\chocolatey-packages\automatic\mysql\mysql.nuspec
NuspecXml     : #document
Ignored       : False
IgnoreMessage :
StreamsPath   : C:\Users\Joseph\Github\chocolatey-packages\automatic\mysql\mysql.json
Streams       :


C:\Users\Joseph\Github\chocolatey-packages\automatic\mysql>git diff
warning: CRLF will be replaced by LF in automatic/mysql/mysql.nuspec.
The file will have its original line endings in your working directory
diff --git a/automatic/mysql/mysql.nuspec b/automatic/mysql/mysql.nuspec
index c1b64bc7b..db4ea71d2 100644
--- a/automatic/mysql/mysql.nuspec
+++ b/automatic/mysql/mysql.nuspec
@@ -26,7 +26,7 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe
     <!-- version should MATCH as closely as possible with the underlying software -->
     <!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
     <!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
-    <version>8.0.31</version>
+    <version>9.0.0</version>
     <!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
     <owners>Maurice Kevenaar; Rob Reynolds</owners>
     <!-- ============================== -->
diff --git a/automatic/mysql/tools/chocolateyInstall.ps1 b/automatic/mysql/tools/chocolateyInstall.ps1
index f9eebca12..d884ad148 100644
--- a/automatic/mysql/tools/chocolateyInstall.ps1
+++ b/automatic/mysql/tools/chocolateyInstall.ps1
@@ -1,7 +1,7 @@
 <EF><BB><BF>$ErrorActionPreference = 'Stop';

-$url = 'https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31-winx64.zip'
-$checksum = 'f51ceeed82756df4f4251400aa2078c1024e71bdd9d03f9b919c8a796a000d89'
+$url = 'https://cdn.mysql.com/Downloads/MySQL-9.0/mysql-9.0.0-winx64.zip'
+$checksum = '78434ad24eca3b6717322446bb5ff0cf3cd8cb223c4e22adb2c67f7a416b6743'
 $checksumType = 'sha256'

 $pp = Get-PackageParameters

IDK why it's not passing CI.

@ArtskydJ ArtskydJ requested a review from mkevenaar July 4, 2024 16:47
Imran-imtiaz48

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(mysql) is on 8.0.31, but newer versions exist
4 participants