Skip to content

Commit

Permalink
tests(homebrew): update archive urls to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
nikaro committed May 17, 2024
1 parent 97faf64 commit 052904f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions lib/modules/manager/homebrew/__fixtures__/ibazel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

=begin
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
=end
# url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
Expand All @@ -23,7 +23,7 @@
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"

# To generate run:
# curl https://codeload.github.com/bazelbuild/bazel-watcher/tar.gz/v0.8.2 | sha256sum
Expand Down
14 changes: 7 additions & 7 deletions lib/modules/manager/homebrew/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('modules/manager/homebrew/extract', () => {
const content = `class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -63,7 +63,7 @@ describe('modules/manager/homebrew/extract', () => {
class Ibazel !?# Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -75,7 +75,7 @@ describe('modules/manager/homebrew/extract', () => {
class Ibazel < NotFormula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -87,7 +87,7 @@ describe('modules/manager/homebrew/extract', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
not_url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
not_url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -102,7 +102,7 @@ describe('modules/manager/homebrew/extract', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url ??https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url ??https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand Down Expand Up @@ -132,7 +132,7 @@ describe('modules/manager/homebrew/extract', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
not_sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -147,7 +147,7 @@ describe('modules/manager/homebrew/extract', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b0229'
end
`;
Expand Down
26 changes: 13 additions & 13 deletions lib/modules/manager/homebrew/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'bazel-watcher',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand Down Expand Up @@ -72,7 +72,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'bazel-watcher',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand Down Expand Up @@ -124,7 +124,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'invalid/repo/name',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand Down Expand Up @@ -154,7 +154,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'wrong-version/archive/v10.2.3.tar.gz',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand All @@ -165,7 +165,7 @@ describe('modules/manager/homebrew/update', () => {
)
.replyWithError('')
.get(
'/bazelbuild/wrong-version/archive/v10.2.3.tar.gz/archive/v0.9.3.tar.gz',
'/bazelbuild/wrong-version/archive/v10.2.3.tar.gz/archive/refs/tags/v0.9.3.tar.gz',
)
.reply(200, Readable.from(['foo']));
const newContent = await updateDependency({
Expand All @@ -181,7 +181,7 @@ describe('modules/manager/homebrew/update', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url ???https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url ???https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 '26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -193,7 +193,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'bazel-watcher',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand Down Expand Up @@ -227,7 +227,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'bazel-watcher',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand All @@ -250,7 +250,7 @@ describe('modules/manager/homebrew/update', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
sha256 ???26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4'
end
`;
Expand All @@ -262,7 +262,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'bazel-watcher',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand All @@ -285,7 +285,7 @@ describe('modules/manager/homebrew/update', () => {
class Ibazel < Formula
desc 'IBazel is a tool for building Bazel targets when source files change.'
homepage 'https://github.com/bazelbuild/bazel-watcher'
url "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
url "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
end
`;
const upgrade = {
Expand All @@ -296,7 +296,7 @@ describe('modules/manager/homebrew/update', () => {
repoName: 'bazel-watcher',
sha256:
'26f5125218fad2741d3caf937b02296d803900e5f153f5b1f733f15391b9f9b4',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz',
url: 'https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz',
},
newValue: 'v0.9.3',
};
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('modules/manager/homebrew/update', () => {
.scope(baseUrl)
.get('/aide/aide/releases/download/v0.17.7/aide-0.17.7.tar.gz')
.replyWithError('')
.get('/aide/aide/archive/v0.17.7.tar.gz')
.get('/aide/aide/archive/refs/tags/v0.17.7.tar.gz')
.replyWithError('');
const newContent = await updateDependency({
fileContent: aide,
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/manager/homebrew/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export async function updateDependency({
*/
let newUrl: string;
// Example urls:
// "https://github.com/bazelbuild/bazel-watcher/archive/v0.8.2.tar.gz"
// "https://github.com/bazelbuild/bazel-watcher/archive/refs/tags/v0.8.2.tar.gz"
// "https://github.com/aide/aide/releases/download/v0.16.1/aide-0.16.1.tar.gz"
const oldParsedUrlPath = parseUrlPath(upgrade.managerData?.url);
if (!oldParsedUrlPath || !upgrade.managerData) {
Expand All @@ -171,7 +171,7 @@ export async function updateDependency({
try {
const ownerName = String(upgrade.managerData.ownerName);
const repoName = String(upgrade.managerData.repoName);
newUrl = `https://github.com/${ownerName}/${repoName}/archive/${upgrade.newValue}.tar.gz`;
newUrl = `https://github.com/${ownerName}/${repoName}/archive/refs/tags/${upgrade.newValue}.tar.gz`;
newSha256 = await hashStream(http.stream(newUrl), 'sha256');
} catch (errInner) {
logger.debug(
Expand Down

0 comments on commit 052904f

Please sign in to comment.