Subversion Repositories DevTools

Rev

Rev 7163 | Rev 7169 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7163 Rev 7164
Line 1... Line 1...
1
package com.erggroup.buildtool.ripple;
1
package com.erggroup.buildtool.ripple;
2
 
2
 
3
import java.sql.SQLException;
3
import java.sql.SQLException;
4
import java.util.ArrayList;
4
import java.util.ArrayList;
5
import java.util.Collections;
5
import java.util.Collections;
6
import java.util.HashMap;
-
 
7
import java.util.Iterator;
6
import java.util.Iterator;
8
import java.util.List;
7
import java.util.List;
9
import java.util.ListIterator;
8
import java.util.ListIterator;
10
 
9
 
11
import org.slf4j.Logger;
10
import org.slf4j.Logger;
Line 121... Line 120...
121
     * Used to provide feedback into RM
120
     * Used to provide feedback into RM
122
     * Only the first entry is about to be built as we re-plan every cycle
121
     * Only the first entry is about to be built as we re-plan every cycle
123
     */
122
     */
124
    private ArrayList<PlannedPackage> mBuildOrder = new ArrayList  <PlannedPackage>();
123
    private ArrayList<PlannedPackage> mBuildOrder = new ArrayList  <PlannedPackage>();
125
 
124
 
126
    /**
-
 
127
     * Used to convert an alias to a package
-
 
128
     * Must be initialized before use
-
 
129
     */
-
 
130
    private  HashMap<String, Package> pkgMap = new HashMap<String, Package>();
-
 
131
 
-
 
132
    /**Warning message
125
    /**Warning message
133
     * @attribute
126
     * @attribute
134
     */
127
     */
135
    private static final String mAnyBuildPlatforms = "Warning. The following package versions are not reproducible on any build platform: ";
128
    private static final String mAnyBuildPlatforms = "Warning. The following package versions are not reproducible on any build platform: ";
136
 
129
 
Line 676... Line 669...
676
                                    // Package marked as a rippleStop
669
                                    // Package marked as a rippleStop
677
                                    // max 50 chars
670
                                    // max 50 chars
678
                                    rippleBuildExclude(p, -2, "Ripple Required." + " Waiting for user", -11);
671
                                    rippleBuildExclude(p, -2, "Ripple Required." + " Waiting for user", -11);
679
 
672
 
680
                                    if (p.mRippleStop == 's' ) {
673
                                    if (p.mRippleStop == 's' ) {
-
 
674
                                        
681
                                        // Need to flag to users that the package build is waiting user action
675
                                        // Need to flag to users that the package build is waiting user action
682
                                        mLogger.info("planRelease Ripple Required. Stopped by flag {}", p.mName);
676
                                        mLogger.info("planRelease Ripple Required. Stopped by flag {}", p.mName);
683
                                        mReleaseManager.setRippleStopWait(mRtagId,p);
677
                                        mReleaseManager.setRippleStopWait(mRtagId,p);
-
 
678
                                        emailRippleStop(p);
684
                                    }
679
                                    }
-
 
680
                                    
685
                                }
681
                                }
686
                                
682
                                
687
                                break;
683
                                break;
688
                            }
684
                            }
689
                        }
685
                        }
Line 2165... Line 2161...
2165
                // Insert build exclusion information
2161
                // Insert build exclusion information
2166
                xml.addComment("mBuildExclusionCollection");
2162
                xml.addComment("mBuildExclusionCollection");
2167
                for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
2163
                for (Iterator<BuildExclusion> it = mBuildExclusionCollection.iterator(); it.hasNext(); )
2168
                {
2164
                {
2169
                    BuildExclusion buildExclusion = it.next();
2165
                    BuildExclusion buildExclusion = it.next();
2170
                    {
-
 
2171
                        xml.addComment(buildExclusion.toString());
2166
                    xml.addComment(buildExclusion.toString());
2172
                    }
-
 
2173
                }
2167
                }
2174
            }
2168
            }
2175
            
2169
            
2176
            // UTF Support (Also while trialing the changes)
2170
            // UTF Support (Also while trialing the changes)
2177
            // Insert build Plan
2171
            // Insert build Plan
Line 2971... Line 2965...
2971
        //  Email Subject
2965
        //  Email Subject
2972
        String subject = "BUILD FAILURE of Daemon Instruction on package " + p.mAlias;
2966
        String subject = "BUILD FAILURE of Daemon Instruction on package " + p.mAlias;
2973
 
2967
 
2974
        // Email Body
2968
        // Email Body
2975
        String mailBody = "The build system reject the the Daemon Instruction";
2969
        String mailBody = "The build system reject the the Daemon Instruction";
2976
        mailBody += "<br>Reason: " + reason; 
2970
        
2977
 
-
 
2978
        mailBody += "<p>Release: " + mBaselineName 
2971
        mailBody += "<p>Release: " + mBaselineName 
2979
                +  "<br>Package: " + p.mAlias 
2972
                 +  "<br>Package: " + p.mAlias
-
 
2973
                 +  "<br>Cause : " + reason
2980
                +  "<br>Rm Ref: " + CreateUrls.generateRmUrl(getRtagId(), p.mId); 
2974
                 +  "<br>Rm Ref: " + CreateUrls.generateRmUrl(getRtagId(), p.mId); 
2981
 
2975
 
2982
        mailBody += "<p><hr>";
2976
        mailBody += "<p><hr>";
2983
 
2977
 
2984
        String target = p.emailInfoNonAntTask(this);
2978
        String target = p.emailInfoNonAntTask(this);
2985
 
2979
 
Line 3003... Line 2997...
3003
        {
2997
        {
3004
            mLogger.warn("Email Failure: emailRejectedDaemonInstruction:{}", e.getMessage());
2998
            mLogger.warn("Email Failure: emailRejectedDaemonInstruction:{}", e.getMessage());
3005
        }
2999
        }
3006
    }
3000
    }
3007
 
3001
 
-
 
3002
    /** Send an email notifying users that a rippleStop has been triggered
-
 
3003
     *  The use will need to take some action
-
 
3004
     * @param p - Package
-
 
3005
     */
-
 
3006
    private void emailRippleStop(Package p) {
-
 
3007
        mLogger.debug("emailRippleStop");
-
 
3008
 
-
 
3009
        //  Email Subject
-
 
3010
        String subject = "BUILD FAILURE on package " + p.mAlias;
-
 
3011
        
-
 
3012
        // Failure Reason
-
 
3013
        String reason = "Ripple Required. Waiting for user action";
-
 
3014
 
-
 
3015
        // Email Body
-
 
3016
        String mailBody = "<p>Release: " + mBaselineName 
-
 
3017
                       +  "<br>Package: " + p.mAlias
-
 
3018
                       +  "<br>Cause : " + reason
-
 
3019
                       +  "<br>Rm Ref: " + CreateUrls.generateRmUrl(getRtagId(), p.mId); 
-
 
3020
 
-
 
3021
        mailBody += "<p><hr>";
-
 
3022
 
-
 
3023
        String target = p.emailInfoNonAntTask(this);
-
 
3024
 
-
 
3025
        mLogger.warn("emailRippleStop Server: {}", getMailServer());
-
 
3026
        mLogger.warn("emailRippleStop Sender: {}", getMailSender());
-
 
3027
        mLogger.warn("emailRippleStop Target: {}", target);
-
 
3028
 
-
 
3029
        try
-
 
3030
        {
-
 
3031
            //    
-
 
3032
            Smtpsend.send(getMailServer(),  // mailServer
-
 
3033
                    getMailSender(),        // source
-
 
3034
                    target,                 // target
-
 
3035
                    getMailSender(),        // cc
-
 
3036
                    null,                   // bcc
-
 
3037
                    subject,                // subject
-
 
3038
                    mailBody,               // body
-
 
3039
                    null                    // attachment
-
 
3040
                    );
-
 
3041
        } catch (Exception e)
-
 
3042
        {
-
 
3043
            mLogger.warn("Email Failure: emailRippleStop:{}", e.getMessage());
-
 
3044
        }
-
 
3045
        
-
 
3046
    }
-
 
3047
 
3008
    /**
3048
    /**
3009
     * @return the mMailServer
3049
     * @return the mMailServer
3010
     */
3050
     */
3011
    public String getMailServer() {
3051
    public String getMailServer() {
3012
        return mMailServer;
3052
        return mMailServer;