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

[scripts] k8s-env automatically switches to es7 on Arm Macs #3830

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@terascope/scripts",
"displayName": "Scripts",
"version": "1.5.0",
"version": "1.5.1",
"description": "A collection of terascope monorepo scripts",
"homepage": "https://github.com/terascope/teraslice/tree/master/packages/scripts#readme",
"bugs": {
Expand Down
19 changes: 17 additions & 2 deletions packages/scripts/src/helpers/test-runner/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { TestOptions } from './interfaces.js';
import { Service } from '../interfaces.js';
import * as config from '../config.js';
import signale from '../signale.js';
import os from 'node:os';

const logger = debugLogger('ts-scripts:cmd:test');

Expand Down Expand Up @@ -625,8 +626,13 @@ async function checkElasticsearch(options: TestOptions, startTime: number): Prom

const actual: string = body.version.number;
const expected = config.ELASTICSEARCH_VERSION;

if (semver.satisfies(actual, `^${expected}`)) {
if (
semver.satisfies(actual, `^${expected}`)
// Or we may override semver match in this scenario
|| (os.arch().includes('arm')
&& expected.startsWith('6') && actual === '7.9.3'
&& options.testPlatform.includes('kubernetes'))
) {
Comment on lines +634 to +635
Copy link
Contributor

Choose a reason for hiding this comment

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

If we do this for docker too this check isn't needed.

const took = toHumanTime(Date.now() - startTime);
signale.success(`elasticsearch@${actual} is running at ${host}, took ${took}`);
return true;
Expand Down Expand Up @@ -837,6 +843,15 @@ async function startService(options: TestOptions, service: Service): Promise<()

if (options.testPlatform === 'kubernetes' || options.testPlatform === 'kubernetesV2') {
const kind = new Kind(config.K8S_VERSION, options.kindClusterName);
// Check for arm architecture and es6 combo, if so switch to es7
if (
service === 'elasticsearch'
&& os.arch().includes('arm')
&& version.startsWith('6')
) {
signale.warn('Detected arm architecture with unsupported es6, switching to es7.9.3..');
version = '7.9.3';
}
Comment on lines +846 to +854
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we do this outside of this if statement so it works for docker as well?

await kind.loadServiceImage(
service,
services[service].image,
Expand Down