Package hudson

Examples of hudson.EnvVars$GetEnvVars


        if (stream == null || "".equals(stream)) {
            listener.fatalError("Must specify a stream");
            return false;
        }

        final EnvVars environment = build.getEnvironment(listener);
        environment.put("ACCUREV_CLIENT_PATH", accurevClientExePath);

        String localStream = environment.expand(stream);

        listener.getLogger().println("Getting a list of streams...");
        final Map<String, AccurevStream> streams = ShowStreams.getStreams(this, localStream, server, accurevEnv, jenkinsWorkspace, listener, accurevClientExePath,
                launcher);

        if (streams != null && !streams.containsKey(localStream)) {
            listener.fatalError("The specified stream, '" + localStream + "' does not appear to exist!");
            return false;
        }
        if (useReftree && (this.reftree == null || "".equals(this.reftree))) {
            listener.fatalError("Must specify a reference tree");
            return false;
        }

        final Date startDateOfPopulate;
        if (useWorkspace){// _accurevWorkspace != null && _accurevWorkspace.is_useAccurevWorkspace() ) {
          AccuRevWorkspaceProcessor acWspace = new AccuRevWorkspaceProcessor(this);
           boolean result = acWspace.checkoutWorkspace( this, launcher, listener, server, accurevEnv, jenkinsWorkspace, accurevClientExePath, accurevWorkingSpace, streams, localStream );
           if (!result) return result;
           startDateOfPopulate = acWspace.get_startDateOfPopulate();
           listener.getLogger().println("Calculating latest transaction info for workspace: " + acWspace._accurevWorkspace + ".");
        } else if (useReftree) {
           AccuRevRefTreeProcessor rTree = new AccuRevRefTreeProcessor(this);
           boolean result = rTree.checkoutRefTree( this, launcher, listener, server, accurevEnv, jenkinsWorkspace, accurevClientExePath, accurevWorkingSpace, streams );
           if (!result) return result;
           startDateOfPopulate = rTree.get_startDateOfPopulate();          
        else if ( isUseSnapshot() ) {
            final String snapshotName = calculateSnapshotName(build, listener);
            listener.getLogger().println("Creating snapshot: " + snapshotName + "...");
            build.getEnvironment(listener).put("ACCUREV_SNAPSHOT", snapshotName);
            // snapshot command: accurev mksnap -H <server> -s <snapshotName> -b <backing_stream> -t now
            final ArgumentListBuilder mksnapcmd = new ArgumentListBuilder();
            mksnapcmd.add(accurevClientExePath);
            mksnapcmd.add("mksnap");
            Command.addServer(mksnapcmd, server);
            mksnapcmd.add("-s");
            mksnapcmd.add(snapshotName);
            mksnapcmd.add("-b");
            mksnapcmd.add(localStream);
            mksnapcmd.add("-t");
            mksnapcmd.add("now");
            if (!AccurevLauncher.runCommand("Create snapshot command", launcher, mksnapcmd, null, getOptionalLock(),
                    accurevEnv, jenkinsWorkspace, listener, logger, true)) {
                return false;
            }
            listener.getLogger().println("Snapshot created successfully.");
           
            PopulateCmd pop = new PopulateCmd();
            if ( pop.populate(this, launcher, listener, server, accurevClientExePath, snapshotName, true, "from workspace", accurevWorkingSpace, accurevEnv) ) {
               startDateOfPopulate = pop.get_startDateOfPopulate();
            } else {
               return false;
            }
            listener.getLogger().println("Calculating latest transaction info for stream: " + localStream + ".");
        } else {
          /*Change the background color of the stream to white as default, this background color can be optionally changed by the users to green/red upon build success/failure
             *using post build action plugins.
             */
             {
               //For AccuRev 6.0.x versions
               SetProperty.setproperty(this, accurevWorkingSpace, listener, accurevClientExePath, launcher, accurevEnv, server, localStream, "#FFFFFF", "style");
              
               //For AccuRev 6.1.x onwards
               SetProperty.setproperty(this, accurevWorkingSpace, listener, accurevClientExePath, launcher, accurevEnv, server, localStream, "#FFFFFF", "streamStyle");               
             }
           PopulateCmd pop = new PopulateCmd();
           if ( pop.populate(this, launcher, listener, server, accurevClientExePath, localStream, true, "from jenkins workspace", accurevWorkingSpace, accurevEnv) ) {
              startDateOfPopulate = pop.get_startDateOfPopulate();
           } else {
              return false;
          
           listener.getLogger().println("Calculating latest transaction info for stream: " + localStream + ".");
        }
       
       
      try {
         if (useWorkspace) {
            localStream = this.workspace;
         }
         AccurevTransaction latestTransaction = History.getLatestTransaction(this,
               server, accurevEnv, accurevWorkingSpace, listener, accurevClientExePath, launcher, localStream, null);
         if (latestTransaction == null) {
            throw new NullPointerException("The 'hist' command did not return a transaction. Does this stream have any history yet?");
         }
         String latestTransactionID = latestTransaction.getId();
         String latestTransactionDate = ACCUREV_DATETIME_FORMATTER.format(latestTransaction.getDate());
         latestTransactionDate = latestTransactionDate == null ? "1970/01/01 00:00:00" : latestTransactionDate;
         listener.getLogger().println("Latest Transaction ID: " + latestTransactionID);
         listener.getLogger().println("Latest transaction Date: " + latestTransactionDate);

         {
            environment.put("ACCUREV_LATEST_TRANSACTION_ID", latestTransactionID);
            environment.put("ACCUREV_LATEST_TRANSACTION_DATE", latestTransactionDate);

            build.addAction(new AccuRevHiddenParametersAction(environment));
         }

      } catch (Exception e) {
View Full Code Here


   
  private String calculateSnapshotName(final AbstractBuild<?, ?> build,
            final BuildListener listener) throws IOException, InterruptedException {
        final String actualFormat = (snapshotNameFormat == null || snapshotNameFormat
                .trim().isEmpty()) ? DEFAULT_SNAPSHOT_NAME_FORMAT : snapshotNameFormat.trim();
        final EnvVars environment = build.getEnvironment(listener);
        final String snapshotName = environment.expand(actualFormat);
        return snapshotName;
    }
View Full Code Here

                    StringParameterValue strdefvalue = (StringParameterValue) defaultValue;
                    keyValues.put(defaultValue.getName(), strdefvalue.value);
                }
            }

            final EnvVars environment = new EnvVars(keyValues);
            localStream = environment.expand(this.stream);
            listener.getLogger().println("... expanded '" + this.stream + "' to '" + localStream + "'.");
        } else {
            localStream = this.stream;
        }
View Full Code Here

        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(1, builds.size());

        Set<String> values = Sets.newHashSet();
        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            assertTrue(buildEnvVar.containsKey("TEST"));
            values.add(buildEnvVar.get("TEST"));
        }
        assertEquals(ImmutableSet.of("hello_abc"), values);

    }
View Full Code Here

        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(2, builds.size());

        Set<String> values = Sets.newHashSet();
        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            assertTrue(buildEnvVar.containsKey("TEST"));
            values.add(buildEnvVar.get("TEST"));
        }
        assertEquals(ImmutableSet.of("hello_abc","hello_xyz"), values);

    }
View Full Code Here

        waitUntilNoActivity();
        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(1, builds.size());

        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            System.out.println(String.format("'%s'", "こんにちは"));
            System.out.println(String.format("'%s'", buildEnvVar.get("TEST")));
            assertEquals("こんにちは", buildEnvVar.get("TEST"));
            assertEquals("hello_abc", buildEnvVar.get("TEST"));
        }

    }
View Full Code Here

        waitUntilNoActivity();
        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(1, builds.size());

        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            assertEquals("こんにちは", buildEnvVar.get("TEST"));
            assertEquals("hello_abc", buildEnvVar.get("TEST"));
        }

    }
View Full Code Here

        waitUntilNoActivity();
        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(1, builds.size());

        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            assertEquals("hello_abc", buildEnvVar.get("TEST"));
        }

    }
View Full Code Here

        waitUntilNoActivity();
        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(2, builds.size());
        Set<String> values = Sets.newHashSet();
        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            assertTrue(buildEnvVar.containsKey("TEST"));
            values.add(buildEnvVar.get("TEST"));
        }
        assertEquals(ImmutableSet.of("COUNT0","COUNT1"), values);
    }
View Full Code Here

        List<FreeStyleBuild> builds = projectB.getBuilds();
        assertEquals(6, builds.size());
        Set<String> values = Sets.newHashSet();
        Set<String> newValues = Sets.newHashSet();
        for (FreeStyleBuild build : builds) {
            EnvVars buildEnvVar = builder.getEnvVars().get(build.getId());
            assertTrue(buildEnvVar.containsKey("TEST"));
            assertTrue(buildEnvVar.containsKey("NEWTEST"));
            values.add(buildEnvVar.get("TEST"));
            newValues.add(buildEnvVar.get("NEWTEST"));
        }
        assertEquals(ImmutableSet.of("COUNT0","COUNT1"), values);
        assertEquals(ImmutableSet.of("COUNT0", "COUNT1", "COUNT2"), newValues);
    }
View Full Code Here

TOP

Related Classes of hudson.EnvVars$GetEnvVars

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.