Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5898

Load rules should be derived from stream foundation - not typed in by user

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Component/s: clearcase-plugin
    • Labels:
      None
    • Environment:
      Windows

      Description

      When using the ClearCase UCM integration of the SCM module the stream's foundation contains a set of baselines that can be analysed for components.

      It's possible to find out which project the stream belong to and the in the project setting read the policy of the project - including the modifiable components.

      For each component it's possible to get it's components root-dir.

      SO based on that analysis it's possible to NOT REQUIRE the job to explicitly list the load rules to use, but simply give the user three options:

      1) Type load rules manaully (as is today)
      2) Automatically load modifiable components from the foundation (new)
      3) Automatically load all components from the foundation (new)

      Options 2+3 would probably cover 95+% of all valid scenarios.

      ...And users would never have to type in a single load rule - ever again

      We already have this setup in perl code - we're willing to migrate to Java and add it to the module - Please give feed back if you would like to see this feature - or if we're the only ones hating to type in load rules in Hudson Jobs?

        Activity

        lakrus lakrus created issue -
        Hide
        lakrus lakrus added a comment -

        Hi - It's me again.

        Just wanted to attach this snippet of code - it's how we do it in our perl script:

        Yes it's in perl and java isn't perl ...but it's really all about cleartool commands - isn't it?

        sub get_load_rules($){

        =pod

        =head2 get_load_rules($fullyqualified__stream)

        Find and return the load rules for the stream.

        Return:

        Load rules.

        =cut

        my $fq_stream = shift;

        my @comps;

        if ($sw_loadall){

        1. The parameter to the script -loadall is cached in $sw_loadall
          my $cmd = "cleartool desc -fmt %[latest_bls]p $fq_stream";
          #output is a white-space separated list of bls
          foreach my $bl (split(/\s+/,execute($cmd))) { chomp($bl); $cmd = "cleartool desc -fmt \%[component]p baseline:$bl\@".DEFAULT_PVOB; $_ = execute($cmd); #At this point $_ caches the component $cmd = "cleartool desc -fmt \"\%[root_dir]p \" component:$_\@".DEFAULT_PVOB; $_ = execute($cmd); # Now $_ contains the root dir+the component name ...almost there now s/^\\//; # Get rid of the backslash from the root-dir which isn't used in load rules (they are relative) push @comps, $_; }

          ;

        } else {

        1. If we're not loainf all, then we're loading modifiable components
          my $project = execute("cleartool desc -fmt %[project]p $fq_stream");

        foreach my $comp (split(/\s+/,execute("cleartool desc -fmt %[mod_comps]p project:$project@".DEFAULT_PVOB)))

        { $_ = execute("cleartool desc -fmt \"\%[root_dir]p \" component:$comp\@".DEFAULT_PVOB); s/^\\//; push @comps, $_; }

        ;

        }

        my $retval = join ("", @comps);

        1. convert the list to a scalar (perl'ish for a string)
          return $retval;

        };

        Show
        lakrus lakrus added a comment - Hi - It's me again. Just wanted to attach this snippet of code - it's how we do it in our perl script: Yes it's in perl and java isn't perl ...but it's really all about cleartool commands - isn't it? sub get_load_rules($){ =pod =head2 get_load_rules($fullyqualified__stream) Find and return the load rules for the stream. Return: Load rules. =cut my $fq_stream = shift; my @comps; if ($sw_loadall){ The parameter to the script -loadall is cached in $sw_loadall my $cmd = "cleartool desc -fmt % [latest_bls] p $fq_stream"; #output is a white-space separated list of bls foreach my $bl (split(/\s+/,execute($cmd))) { chomp($bl); $cmd = "cleartool desc -fmt \%[component]p baseline:$bl\@".DEFAULT_PVOB; $_ = execute($cmd); #At this point $_ caches the component $cmd = "cleartool desc -fmt \"\%[root_dir]p \" component:$_\@".DEFAULT_PVOB; $_ = execute($cmd); # Now $_ contains the root dir+the component name ...almost there now s/^\\//; # Get rid of the backslash from the root-dir which isn't used in load rules (they are relative) push @comps, $_; } ; } else { If we're not loainf all, then we're loading modifiable components my $project = execute("cleartool desc -fmt % [project] p $fq_stream"); foreach my $comp (split(/\s+/,execute("cleartool desc -fmt % [mod_comps] p project:$project@".DEFAULT_PVOB))) { $_ = execute("cleartool desc -fmt \"\%[root_dir]p \" component:$comp\@".DEFAULT_PVOB); s/^\\//; push @comps, $_; } ; } my $retval = join ("", @comps); convert the list to a scalar (perl'ish for a string) return $retval; };
        vlatombe Vincent Latombe made changes -
        Field Original Value New Value
        Assignee abayer [ abayer ] vlatombe [ vlatombe ]
        Hide
        vlatombe Vincent Latombe added a comment -

        Implemented in trunk

        Show
        vlatombe Vincent Latombe added a comment - Implemented in trunk
        vlatombe Vincent Latombe made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        vlatombe Vincent Latombe added a comment -

        Implemented from 1.3

        Show
        vlatombe Vincent Latombe added a comment - Implemented from 1.3
        vlatombe Vincent Latombe made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            vlatombe Vincent Latombe
            Reporter:
            lakrus lakrus
          • Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: