@@ -177,37 +177,17 @@ func batchDefaultCacheDir() string {
177177 if err != nil {
178178 return ""
179179 }
180-
181- // Check if there's an old campaigns cache directory but not a new batch
182- // directory: if so, we should rename the old directory and carry on.
183- //
184- // TODO(campaigns-deprecation): we can remove this migration shim after June
185- // 2021.
186- old := path .Join (uc , "sourcegraph" , "campaigns" )
187180 dir := path .Join (uc , "sourcegraph" , "batch" )
188- if _ , err := os .Stat (dir ); os .IsNotExist (err ) {
189- if _ , err := os .Stat (old ); os .IsExist (err ) {
190- // We'll just try to do this without checking for an error: if it
191- // fails, we'll carry on and let the normal cache directory handling
192- // logic take care of it.
193- os .Rename (old , dir )
194- }
195- }
196181
197182 return dir
198183}
199184
200185// batchDefaultTempDirPrefix returns the prefix to be passed to ioutil.TempFile.
201- // If one of the environment variables SRC_BATCH_TMP_DIR or
202- // SRC_CAMPAIGNS_TMP_DIR is set, that is used as the prefix. Otherwise we use
203- // "/tmp".
186+ // If the environment variable SRC_BATCH_TMP_DIR is set, that is used as the prefix.
187+ // Otherwise we use "/tmp".
204188func batchDefaultTempDirPrefix () string {
205- // TODO(campaigns-deprecation): we can remove this migration shim in
206- // Sourcegraph 4.0.
207- for _ , env := range []string {"SRC_BATCH_TMP_DIR" , "SRC_CAMPAIGNS_TMP_DIR" } {
208- if p := os .Getenv (env ); p != "" {
209- return p
210- }
189+ if p := os .Getenv ("SRC_BATCH_TMP_DIR" ); p != "" {
190+ return p
211191 }
212192
213193 // On macOS, we use an explicit prefix for our temp directories, because
@@ -280,7 +260,7 @@ func executeBatchSpec(ctx context.Context, ui ui.ExecUI, opts executeBatchSpecOp
280260
281261 imageCache := docker .NewImageCache ()
282262
283- if err := svc . DetermineFeatureFlags (ctx ); err != nil {
263+ if err := validateSourcegraphVersionConstraint (ctx , svc ); err != nil {
284264 return err
285265 }
286266
@@ -399,7 +379,6 @@ func executeBatchSpec(ctx context.Context, ui ui.ExecUI, opts executeBatchSpecOp
399379 GlobalEnv : os .Environ (),
400380 IsRemote : false ,
401381 },
402- Features : svc .Features (),
403382 Logger : logManager ,
404383 Cache : executor .NewDiskCache (opts .flags .cacheDir ),
405384 GlobalEnv : os .Environ (),
@@ -604,3 +583,14 @@ func getBatchParallelism(ctx context.Context, flag int) (int, error) {
604583
605584 return docker .NCPU (ctx )
606585}
586+
587+ func validateSourcegraphVersionConstraint (ctx context.Context , svc * service.Service ) error {
588+ ffs , err := svc .DetermineFeatureFlags (ctx )
589+ if err != nil {
590+ return err
591+ }
592+ if ffs .Sourcegraph40 {
593+ return nil
594+ }
595+ return errors .Newf ("\n \n * Warning:\n This version of src-cli requires Sourcegraph version 4.0 or newer. If you're not on Sourcegraph 4.0 or newer, please use the 3.x release of src-cli that corresponds to your Sourcegraph version.\n \n " )
596+ }
0 commit comments