Skip to content

Commit

Permalink
Hotfix: Fix version checking in image-tag (#640)
Browse files Browse the repository at this point in the history
* Update version check regex and fix tests
  • Loading branch information
AndrewKahr authored Mar 17, 2024
1 parent 0c16aab commit dd42746
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/model/image-tag.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import ImageTag from './image-tag';

describe('ImageTag', () => {
const testImageParameters = {
editorVersion: '2099.9.f9f9',
editorVersion: '2099.9.9f9',
targetPlatform: 'Test',
builderPlatform: '',
containerRegistryRepository: 'unityci/editor',
Expand All @@ -27,7 +27,7 @@ describe('ImageTag', () => {
expect(image.builderPlatform).toStrictEqual(testImageParameters.builderPlatform);
});

test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f1'])('accepts %p version format', (version) => {
expect(
() =>
new ImageTag({
Expand All @@ -50,23 +50,23 @@ describe('ImageTag', () => {
describe('toString', () => {
it('returns the correct version', () => {
const image = new ImageTag({
editorVersion: '2099.1.1111',
editorVersion: '2099.1.1111f1',
targetPlatform: testImageParameters.targetPlatform,
containerRegistryRepository: 'unityci/editor',
containerRegistryImageVersion: '3',
});
switch (process.platform) {
case 'win32':
expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2099.1.1111-3`);
expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2099.1.1111f1-3`);
break;
case 'linux':
expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2099.1.1111-3`);
expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2099.1.1111f1-3`);
break;
}
});
it('returns customImage if given', () => {
const image = new ImageTag({
editorVersion: '2099.1.1111',
editorVersion: '2099.1.1111f1',
targetPlatform: testImageParameters.targetPlatform,
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
containerRegistryRepository: 'unityci/editor',
Expand Down
2 changes: 1 addition & 1 deletion src/model/image-tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ImageTag {
}

static get versionPattern(): RegExp {
return /^(20\d{2}\.\d\.\w{3,4}|3)$/;
return /^\d+\.\d+\.\d+[a-z]\d+$/;
}

static get targetPlatformSuffixes() {
Expand Down

0 comments on commit dd42746

Please sign in to comment.