1- import { mkdirSync , readFileSync , writeFileSync } from "node:fs" ;
1+ import { mkdirSync , readFileSync , rmSync , writeFileSync } from "node:fs" ;
22import { join } from "node:path" ;
33import { run } from "./lib/process" ;
44import { IntegrationLogger } from "./lib/logger" ;
55import { loadIntegrationConfig } from "./config" ;
6+ import { TERRARIUM_ANSIBLE_PIP_PACKAGES } from "../../scripts/ctl/ansible-runtime" ;
67import type {
78 DomainBundle ,
89 ExternalOidcFixture ,
@@ -37,6 +38,16 @@ function describeCleanupStep(step: CleanupStep): string {
3738 return `ZITADEL project ${ step . projectId } ` ;
3839}
3940
41+ function ansibleWheelhousePlatform ( binaryTarget : string ) : string {
42+ if ( binaryTarget === "x64" ) {
43+ return "manylinux2014_x86_64" ;
44+ }
45+ if ( binaryTarget === "arm64" ) {
46+ return "manylinux2014_aarch64" ;
47+ }
48+ throw new Error ( `unsupported integration binary target for Ansible wheelhouse: ${ binaryTarget } ` ) ;
49+ }
50+
4051/** Global per-run context shared by all integration scenarios. */
4152export class IntegrationContext {
4253 readonly config : IntegrationConfig ;
@@ -90,6 +101,31 @@ export class IntegrationContext {
90101 { cwd : this . config . repoRoot }
91102 ) ;
92103
104+ const wheelhousePath = join ( this . linuxBundleDir , "ansible-wheelhouse" ) ;
105+ rmSync ( wheelhousePath , { recursive : true , force : true } ) ;
106+ mkdirSync ( wheelhousePath , { recursive : true } ) ;
107+ await run (
108+ [
109+ "python3" ,
110+ "-m" ,
111+ "pip" ,
112+ "download" ,
113+ "--dest" ,
114+ wheelhousePath ,
115+ "--only-binary=:all:" ,
116+ "--implementation" ,
117+ "cp" ,
118+ "--python-version" ,
119+ "312" ,
120+ "--abi" ,
121+ "cp312" ,
122+ "--platform" ,
123+ ansibleWheelhousePlatform ( this . config . hcloudBinaryTarget ) ,
124+ ...TERRARIUM_ANSIBLE_PIP_PACKAGES
125+ ] ,
126+ { cwd : this . config . repoRoot }
127+ ) ;
128+
93129 await run (
94130 [
95131 "tar" ,
@@ -98,8 +134,14 @@ export class IntegrationContext {
98134 "--exclude=.git" ,
99135 "--exclude=node_modules" ,
100136 "--exclude=dist" ,
137+ "--exclude=ansible-wheelhouse" ,
101138 "--exclude=tests/integration/output" ,
102- "."
139+ "-C" ,
140+ this . config . repoRoot ,
141+ "." ,
142+ "-C" ,
143+ this . linuxBundleDir ,
144+ "ansible-wheelhouse"
103145 ] ,
104146 { cwd : this . config . repoRoot }
105147 ) ;
0 commit comments