Skip to content

Commit 09df856

Browse files
authored
fix(module-k8s): fix deploymentImageId in module conversion (#7026)
* Revert "ci(e2e): temporarily disable more e2e tests (#6967)" This reverts commit e755e0c. * Revert "ci(e2e): temporarily mute some e2e tests (#6965)" This reverts commit 80f994a. * fix(module-k8s): fix `deploymentImageId` in module conversion
1 parent 54ccdd7 commit 09df856

File tree

2 files changed

+161
-158
lines changed

2 files changed

+161
-158
lines changed

.circleci/continue-config.yml

Lines changed: 153 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,68 +1163,67 @@ jobs:
11631163
filter: $CIRCLE_BUILD_NUM-macos-arm
11641164
- fail_fast
11651165

1166-
# TODO: Re-enable once we fix gcr issue
1167-
# test-windows:
1168-
# executor:
1169-
# name: win/server-2022
1170-
# size: large
1171-
# steps:
1172-
# - checkout
1173-
# - *attach-workspace
1174-
# - run:
1175-
# # Print PowerShell version for diagnostics
1176-
# name: Print PowerShell versions
1177-
# command: $PSVersionTable
1178-
# - run:
1179-
# # Print Chocolatey version for diagnostics
1180-
# name: Print Chocolatey versions
1181-
# command: choco --version
1182-
# - run:
1183-
# name: Install Deps
1184-
# command: |
1185-
# Import-Module "$Env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
1186-
# choco install --limit-output --no-progress -y git gcloudsdk kubernetes-cli
1187-
# $Env:CLOUDSDK_PYTHON = gcloud components copy-bundled-python
1188-
# gcloud components install gke-gcloud-auth-plugin --quiet
1189-
# $Env:USE_GKE_GCLOUD_AUTH_PLUGIN = True
1190-
# refreshenv
1191-
# - run:
1192-
# name: Write gcloud credentials to file
1193-
# command: $env:GCLOUD_SERVICE_KEY | Set-Content key.json
1194-
# - run:
1195-
# name: Setup remote K8s
1196-
# command: |
1197-
# gcloud auth activate-service-account --key-file=key.json
1198-
# $env:GOOGLE_APPLICATION_CREDENTIALS = (Get-Location) + '\key.json'
1199-
# gcloud --quiet config set project $env:GOOGLE_PROJECT_ID
1200-
# gcloud --quiet config set compute/zone $env:GOOGLE_COMPUTE_ZONE
1201-
# gcloud --quiet container clusters get-credentials $env:GOOGLE_CLUSTER_ID --zone $env:GOOGLE_COMPUTE_ZONE
1202-
# gcloud --quiet auth configure-docker
1203-
# - run:
1204-
# name: Deploy demo-project
1205-
# command: |
1206-
# .\dist\windows-amd64\garden.exe deploy --root .\examples\demo-project\ --logger-type basic --log-level silly --env remote --force-build --var userId=$env:CIRCLE_BUILD_NUM-win
1207-
# - run:
1208-
# name: Cleanup demo-project
1209-
# command: (kubectl delete namespace --wait=false demo-project-testing-$env:CIRCLE_BUILD_NUM-win) -or $true
1210-
# when: always
1211-
# - run:
1212-
# name: Validate vote-helm project # to validate the sync mode paths on Windows with action-based configs
1213-
# command: |
1214-
# .\dist\windows-amd64\garden.exe validate --root .\e2e\projects\vote-helm\ --logger-type basic --log-level silly --env testing --var userId=$env:CIRCLE_BUILD_NUM-win
1215-
# - run:
1216-
# name: Cleanup vote-helm project
1217-
# command: (kubectl delete namespace --wait=false vote-helm-testing-$env:CIRCLE_BUILD_NUM-win) -or $true
1218-
# when: always
1219-
# - run:
1220-
# name: Validate vote-helm-modules project # to validate the sync mode paths on Windows with module-based configs
1221-
# command: |
1222-
# .\dist\windows-amd64\garden.exe validate --root .\e2e\projects\vote-helm-modules\ --logger-type basic --log-level silly --env testing --var userId=$env:CIRCLE_BUILD_NUM-win
1223-
# - run:
1224-
# name: Cleanup vote-helm-modules project
1225-
# command: (kubectl delete namespace --wait=false vote-helm-modules-testing-$env:CIRCLE_BUILD_NUM-win) -or $true
1226-
# when: always
1227-
# - fail_fast
1166+
test-windows:
1167+
executor:
1168+
name: win/server-2022
1169+
size: large
1170+
steps:
1171+
- checkout
1172+
- *attach-workspace
1173+
- run:
1174+
# Print PowerShell version for diagnostics
1175+
name: Print PowerShell versions
1176+
command: $PSVersionTable
1177+
- run:
1178+
# Print Chocolatey version for diagnostics
1179+
name: Print Chocolatey versions
1180+
command: choco --version
1181+
- run:
1182+
name: Install Deps
1183+
command: |
1184+
Import-Module "$Env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
1185+
choco install --limit-output --no-progress -y git gcloudsdk kubernetes-cli
1186+
$Env:CLOUDSDK_PYTHON = gcloud components copy-bundled-python
1187+
gcloud components install gke-gcloud-auth-plugin --quiet
1188+
$Env:USE_GKE_GCLOUD_AUTH_PLUGIN = True
1189+
refreshenv
1190+
- run:
1191+
name: Write gcloud credentials to file
1192+
command: $env:GCLOUD_SERVICE_KEY | Set-Content key.json
1193+
- run:
1194+
name: Setup remote K8s
1195+
command: |
1196+
gcloud auth activate-service-account --key-file=key.json
1197+
$env:GOOGLE_APPLICATION_CREDENTIALS = (Get-Location) + '\key.json'
1198+
gcloud --quiet config set project $env:GOOGLE_PROJECT_ID
1199+
gcloud --quiet config set compute/zone $env:GOOGLE_COMPUTE_ZONE
1200+
gcloud --quiet container clusters get-credentials $env:GOOGLE_CLUSTER_ID --zone $env:GOOGLE_COMPUTE_ZONE
1201+
gcloud --quiet auth configure-docker
1202+
- run:
1203+
name: Deploy demo-project
1204+
command: |
1205+
.\dist\windows-amd64\garden.exe deploy --root .\examples\demo-project\ --logger-type basic --log-level silly --env remote --force-build --var userId=$env:CIRCLE_BUILD_NUM-win
1206+
- run:
1207+
name: Cleanup demo-project
1208+
command: (kubectl delete namespace --wait=false demo-project-testing-$env:CIRCLE_BUILD_NUM-win) -or $true
1209+
when: always
1210+
- run:
1211+
name: Validate vote-helm project # to validate the sync mode paths on Windows with action-based configs
1212+
command: |
1213+
.\dist\windows-amd64\garden.exe validate --root .\e2e\projects\vote-helm\ --logger-type basic --log-level silly --env testing --var userId=$env:CIRCLE_BUILD_NUM-win
1214+
- run:
1215+
name: Cleanup vote-helm project
1216+
command: (kubectl delete namespace --wait=false vote-helm-testing-$env:CIRCLE_BUILD_NUM-win) -or $true
1217+
when: always
1218+
- run:
1219+
name: Validate vote-helm-modules project # to validate the sync mode paths on Windows with module-based configs
1220+
command: |
1221+
.\dist\windows-amd64\garden.exe validate --root .\e2e\projects\vote-helm-modules\ --logger-type basic --log-level silly --env testing --var userId=$env:CIRCLE_BUILD_NUM-win
1222+
- run:
1223+
name: Cleanup vote-helm-modules project
1224+
command: (kubectl delete namespace --wait=false vote-helm-modules-testing-$env:CIRCLE_BUILD_NUM-win) -or $true
1225+
when: always
1226+
- fail_fast
12281227

12291228
workflows:
12301229
version: 2
@@ -1263,114 +1262,113 @@ workflows:
12631262
- test-dockerhub:
12641263
<<: *only-prs
12651264
requires: [build-dist-linux-windows]
1266-
# TODO: Re-enable once we fix gcr issue
1267-
# - test-windows:
1268-
# <<: *only-internal-prs
1269-
# requires: [build-dist-linux-windows]
1265+
- test-windows:
1266+
<<: *only-internal-prs
1267+
requires: [build-dist-linux-windows]
12701268

12711269
# - e2e-project:
12721270
# <<: *only-internal-prs
12731271
# name: e2e-code-synchronization
12741272
# project: code-synchronization
12751273
# requires: [build]
1276-
# - e2e-project:
1277-
# <<: *only-internal-prs
1278-
# name: e2e-demo-project
1279-
# project: demo-project
1280-
# environment: remote
1281-
# requires: [build]
1282-
# - e2e-project:
1283-
# <<: *only-internal-prs
1284-
# name: e2e-demo-project-modules
1285-
# project: demo-project-modules
1286-
# environment: remote
1287-
# requires: [build]
1288-
# - e2e-project:
1289-
# <<: *only-internal-prs
1290-
# name: e2e-gke-kaniko
1291-
# project: gke
1292-
# environment: gke-kaniko
1293-
# requires: [build]
1294-
# - e2e-project:
1295-
# <<: *only-internal-prs
1296-
# name: e2e-gke-buildkit
1297-
# project: gke
1298-
# environment: gke-buildkit
1299-
# requires: [build]
1300-
# - e2e-project:
1301-
# <<: *only-internal-prs
1302-
# name: e2e-jib-container
1303-
# project: jib-container
1304-
# environment: remote
1305-
# requires: [build]
1306-
# - e2e-project:
1307-
# <<: *only-internal-prs
1308-
# name: e2e-jib-container-modules
1309-
# project: jib-container-modules
1310-
# environment: remote
1311-
# requires: [build]
1312-
# - e2e-project:
1313-
# <<: *only-internal-prs
1314-
# name: e2e-kustomize
1315-
# project: kustomize
1316-
# requires: [build]
1317-
# - e2e-project:
1318-
# <<: *only-internal-prs
1319-
# name: e2e-kustomize-modules
1320-
# project: kustomize-modules
1321-
# requires: [build]
1274+
- e2e-project:
1275+
<<: *only-internal-prs
1276+
name: e2e-demo-project
1277+
project: demo-project
1278+
environment: remote
1279+
requires: [build]
1280+
- e2e-project:
1281+
<<: *only-internal-prs
1282+
name: e2e-demo-project-modules
1283+
project: demo-project-modules
1284+
environment: remote
1285+
requires: [build]
1286+
- e2e-project:
1287+
<<: *only-internal-prs
1288+
name: e2e-gke-kaniko
1289+
project: gke
1290+
environment: gke-kaniko
1291+
requires: [build]
1292+
- e2e-project:
1293+
<<: *only-internal-prs
1294+
name: e2e-gke-buildkit
1295+
project: gke
1296+
environment: gke-buildkit
1297+
requires: [build]
1298+
- e2e-project:
1299+
<<: *only-internal-prs
1300+
name: e2e-jib-container
1301+
project: jib-container
1302+
environment: remote
1303+
requires: [build]
1304+
- e2e-project:
1305+
<<: *only-internal-prs
1306+
name: e2e-jib-container-modules
1307+
project: jib-container-modules
1308+
environment: remote
1309+
requires: [build]
1310+
- e2e-project:
1311+
<<: *only-internal-prs
1312+
name: e2e-kustomize
1313+
project: kustomize
1314+
requires: [build]
1315+
- e2e-project:
1316+
<<: *only-internal-prs
1317+
name: e2e-kustomize-modules
1318+
project: kustomize-modules
1319+
requires: [build]
13221320
# - e2e-project:
13231321
# <<: *only-internal-prs
13241322
# name: e2e-remote-sources
13251323
# project: remote-sources
13261324
# requires: [build]
1327-
# - e2e-project:
1328-
# <<: *only-internal-prs
1329-
# name: e2e-remote-sources-modules
1330-
# project: remote-sources-modules
1331-
# requires: [build]
1332-
# - e2e-project:
1333-
# <<: *only-internal-prs
1334-
# name: e2e-run-actions
1335-
# project: run-actions
1336-
# requires: [build]
1325+
- e2e-project:
1326+
<<: *only-internal-prs
1327+
name: e2e-remote-sources-modules
1328+
project: remote-sources-modules
1329+
requires: [build]
1330+
- e2e-project:
1331+
<<: *only-internal-prs
1332+
name: e2e-run-actions
1333+
project: run-actions
1334+
requires: [build]
13371335
# - e2e-project:
13381336
# <<: *only-internal-prs
13391337
# name: e2e-tasks-modules
13401338
# project: tasks-modules
13411339
# requires: [build]
1342-
# - e2e-project:
1343-
# <<: *only-internal-prs
1344-
# name: e2e-templated-k8s-container
1345-
# project: templated-k8s-container
1346-
# requires: [build]
1347-
# - e2e-project:
1348-
# <<: *only-internal-prs
1349-
# name: e2e-templated-k8s-container-modules
1350-
# project: templated-k8s-container-modules
1351-
# requires: [build]
1352-
# - e2e-project:
1353-
# <<: *only-internal-prs
1354-
# name: e2e-vote
1355-
# project: vote
1356-
# environment: remote
1357-
# requires: [build]
1358-
# - e2e-project:
1359-
# <<: *only-internal-prs
1360-
# name: e2e-vote-modules
1361-
# project: vote-modules
1362-
# environment: remote
1363-
# requires: [build]
1364-
# - e2e-project:
1365-
# <<: *only-internal-prs
1366-
# name: e2e-vote-helm
1367-
# project: vote-helm
1368-
# requires: [build]
1369-
# - e2e-project:
1370-
# <<: *only-internal-prs
1371-
# name: e2e-open-telemetry
1372-
# project: open-telemetry
1373-
# requires: [build]
1340+
- e2e-project:
1341+
<<: *only-internal-prs
1342+
name: e2e-templated-k8s-container
1343+
project: templated-k8s-container
1344+
requires: [build]
1345+
- e2e-project:
1346+
<<: *only-internal-prs
1347+
name: e2e-templated-k8s-container-modules
1348+
project: templated-k8s-container-modules
1349+
requires: [build]
1350+
- e2e-project:
1351+
<<: *only-internal-prs
1352+
name: e2e-vote
1353+
project: vote
1354+
environment: remote
1355+
requires: [build]
1356+
- e2e-project:
1357+
<<: *only-internal-prs
1358+
name: e2e-vote-modules
1359+
project: vote-modules
1360+
environment: remote
1361+
requires: [build]
1362+
- e2e-project:
1363+
<<: *only-internal-prs
1364+
name: e2e-vote-helm
1365+
project: vote-helm
1366+
requires: [build]
1367+
- e2e-project:
1368+
<<: *only-internal-prs
1369+
name: e2e-open-telemetry
1370+
project: open-telemetry
1371+
requires: [build]
13741372
# - e2e-project:
13751373
# <<: *only-internal-prs
13761374
# name: e2e-vote-helm-modules
@@ -1409,7 +1407,7 @@ workflows:
14091407
k3sVersion: v1.31.1+k3s1
14101408
- test-minikube:
14111409
name: vm-1.31-minikube
1412-
requires: [build]
1410+
requires: [ build ]
14131411
kubernetesVersion: "v1.31.0"
14141412
minikubeVersion: "v1.34.0"
14151413

core/src/plugins/container/container.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,15 @@ function convertContainerModuleRuntimeActions(
364364

365365
let deploymentImageId = module.spec.image
366366

367-
// If the module neeeds container build, we need to add the module version as the tag.
367+
// If the module needs container build, we need to add the module version as the tag.
368368
// If it doesn't need a container build, the module doesn't have a build action and just downloads a prebuilt image
369-
if (needsContainerBuild) {
370-
deploymentImageId = containerHelpers.getModuleDeploymentImageId(module, module.version, undefined)
369+
if (needsContainerBuild && buildAction) {
370+
// Hack: we are in the container provider, and do not yet have access to kubernetes provider config.
371+
// So, we cannot get the info on the deployment container registry.
372+
// Thus, we use template string here to reference tje deploymentImageId.
373+
// This is safe because module name is validated here,
374+
// and the valid module name always results in a valid template expression.
375+
deploymentImageId = `\${actions.build.${buildAction.name}.outputs.deploymentImageId}`
371376
}
372377

373378
function configureActionVolumes(action: ContainerRuntimeActionConfig, volumeSpec: ContainerModuleVolumeSpec[]) {

0 commit comments

Comments
 (0)