@@ -4,7 +4,7 @@ import { assertInRepo, inRepo, requires, TState } from './inject';
4
4
import { loadExistingEnvs } from './env/cmd/list' ;
5
5
import { execSync } from 'child_process' ;
6
6
import { canonicalPaths } from '../metadata/paths' ;
7
- import { TDeployedContract , TDeployedContractsManifest , TDeployStateMutations , TEnvironmentManifest } from '../metadata/schema' ;
7
+ import { TDeploy , TDeployedContract , TDeployedContractsManifest , TDeployManifest , TDeployStateMutations , TEnvironmentManifest , TUpgrade } from '../metadata/schema' ;
8
8
import { TDeployedInstance } from '../metadata/schema' ;
9
9
import * as allArgs from './args' ;
10
10
import { Transaction } from '../metadata/metadataStore' ;
@@ -52,6 +52,10 @@ export interface TBaseZeusEnv {
52
52
ZEUS_ENV_COMMIT : string ,
53
53
ZEUS_ENV_VERSION : string
54
54
ZEUS_VERSION : string
55
+
56
+ // information from the zeus upgrade object (from => to)
57
+ ZEUS_DEPLOY_FROM_VERSION : string ,
58
+ ZEUS_DEPLOY_TO_VERSION : string ,
55
59
}
56
60
57
61
// if `withDeploy` is specified, we also inject instances/statics updated as part of the deploy.
@@ -60,7 +64,10 @@ export const injectableEnvForEnvironment: (txn: Transaction, env: string, withDe
60
64
if ( ! envManifest . _ . id ) {
61
65
throw new Error ( `No such environment: ${ env } ` ) ;
62
66
}
63
-
67
+
68
+ const deployInfo = withDeploy ? ( await txn . getJSONFile < TDeploy > ( canonicalPaths . deployStatus ( { env, name : withDeploy } ) ) ) . _ : undefined ;
69
+ const upgradeInfo = ( withDeploy && deployInfo ) ? ( await txn . getJSONFile < TUpgrade > ( canonicalPaths . upgradeManifest ( deployInfo . upgrade ) ) ) : undefined ;
70
+
64
71
const deployManifest : TDeployedContractsManifest = withDeploy ? ( await txn . getJSONFile < TDeployedContractsManifest > ( canonicalPaths . deployDeployedContracts ( { env, name : withDeploy } ) ) ) . _ : { contracts : [ ] } ;
65
72
const deployParameters = await txn . getJSONFile < Record < string , string > > ( canonicalPaths . deployParameters (
66
73
'' ,
@@ -96,6 +103,10 @@ export const injectableEnvForEnvironment: (txn: Transaction, env: string, withDe
96
103
ZEUS_ENV_COMMIT : envManifest . _ . latestDeployedCommit ,
97
104
ZEUS_TEST : 'false' , /* test environments should override this */
98
105
ZEUS_ENV_VERSION : envManifest . _ . deployedVersion ,
106
+
107
+ ZEUS_DEPLOY_FROM_VERSION : upgradeInfo ?. _ . from ?? `` ,
108
+ ZEUS_DEPLOY_TO_VERSION : upgradeInfo ?. _ . to ?? `` ,
109
+
99
110
ZEUS_VERSION : zeusInfo . Version ,
100
111
...( deployParametersToEnvironmentVariables ( {
101
112
...( deployParameters . _ ?? { } ) ,
0 commit comments