@@ -41,6 +41,12 @@ export interface InstallOpts {
4141 daemonConfig ?: string ;
4242}
4343
44+ interface LimaImage {
45+ location : string ;
46+ arch : string ;
47+ digest ?: string ;
48+ }
49+
4450export class Install {
4551 private readonly runDir : string ;
4652 private readonly version : string ;
@@ -136,8 +142,9 @@ export class Install {
136142 await io . mkdirP ( limaDir ) ;
137143 const dockerHost = `unix://${ limaDir } /docker.sock` ;
138144
139- // avoid brew to upgrade unrelated packages.
145+ // avoid brew to auto update and upgrade unrelated packages.
140146 let envs = Object . assign ( { } , process . env , {
147+ HOMEBREW_NO_AUTO_UPDATE : '1' ,
141148 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK : '1'
142149 } ) as {
143150 [ key : string ] : string ;
@@ -149,6 +156,10 @@ export class Install {
149156 } ) ;
150157 }
151158
159+ await core . group ( 'Lima version' , async ( ) => {
160+ await Exec . exec ( 'lima' , [ '--version' ] , { env : envs } ) ;
161+ } ) ;
162+
152163 await core . group ( 'Creating lima config' , async ( ) => {
153164 let limaDaemonConfig = { } ;
154165 if ( this . daemonConfig ) {
@@ -158,6 +169,7 @@ export class Install {
158169 return new handlebars . SafeString ( JSON . stringify ( obj ) ) ;
159170 } ) ;
160171 const limaCfg = handlebars . compile ( limaYamlData ) ( {
172+ customImages : Install . limaCustomImages ( ) ,
161173 daemonConfig : limaDaemonConfig ,
162174 dockerSock : `${ limaDir } /docker.sock` ,
163175 dockerBinVersion : this . _version ,
@@ -182,7 +194,7 @@ export class Install {
182194 } ;
183195
184196 await core . group ( 'Starting lima instance' , async ( ) => {
185- const limaStartArgs = [ 'start' , `--name=${ this . limaInstanceName } ` , '--tty=false' ] ;
197+ const limaStartArgs = [ 'start' , `--name=${ this . limaInstanceName } ` ] ;
186198 if ( process . env . LIMA_START_ARGS ) {
187199 limaStartArgs . push ( process . env . LIMA_START_ARGS ) ;
188200 }
@@ -507,4 +519,25 @@ EOF`,
507519 }
508520 return releases [ version ] ;
509521 }
522+
523+ public static limaCustomImages ( ) : LimaImage [ ] {
524+ const res : LimaImage [ ] = [ ] ;
525+ const env = process . env . LIMA_IMAGES ;
526+ if ( ! env ) {
527+ return res ;
528+ }
529+ for ( const input of Util . getList ( env , { ignoreComma : true , comment : '#' } ) ) {
530+ const archIndex = input . indexOf ( ':' ) ;
531+ const arch = input . substring ( 0 , archIndex ) . trim ( ) ;
532+ const digestIndex = input . indexOf ( '@' ) ;
533+ const location = input . substring ( archIndex + 1 , digestIndex !== - 1 ? digestIndex : undefined ) . trim ( ) ;
534+ const digest = digestIndex !== - 1 ? input . substring ( digestIndex + 1 ) . trim ( ) : '' ;
535+ res . push ( {
536+ location : location ,
537+ arch : arch ,
538+ digest : digest
539+ } ) ;
540+ }
541+ return res ;
542+ }
510543}
0 commit comments