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

[aws-codebuild] Extract inline script blocks in CodeBuildAction/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 22
      ----
      <script type="text/javascript">
      
                      if("${it.jenkinsBuildSucceeds}" == "") {
                          document.write('<h2>Current Build Status: <font color="blue">${it.buildStatus}</font></h2>');
                      } else {
                          if("${it.buildStatus}" == "SUCCEEDED") {
                              if("${it.jenkinsBuildSucceeds}" == "true") {
                                  document.write('<h2>Current Build Status: <font color="green">${it.buildStatus}</font></h2>');
                              } else {
                                  document.write('<h2>Current Build Status: <font color="red">FAILED</font></h2>');
                                  document.write("The build succeeded in CodeBuild but failed in Jenkins. You can still find your artifacts at the link below. ")
                                  document.write('Consult the <a href="../console">console output.</a>');
                                  document.write('<br />');
                              }
                          } else if("${it.buildStatus}" == "FAILED") {
                              document.write('<h2>Current Build Status: <font color="red">FAILED</font></h2>');
                          } else if("${it.buildStatus}" == "STOPPED") {
                              document.write('<h2>Current Build Status: <font color="red">STOPPED</font></h2>');
                          } else {
                              if("${it.jenkinsBuildSucceeds}" == "false") {
                                  document.write('<h2>Current Build Status: <font color="red">FAILED</font></h2>');
                              }
                          }
                      }
                  </script>
      ----
      
      == Inline Script Block
      Line: 48
      ----
      <script type="text/javascript">
                      document.write('<h3><a href="${it.codeBuildDashboardURL}" target="_blank">AWS CodeBuild Console</a></h3>');
                  </script>
      ----
      
      == Inline Script Block
      Line: 80
      ----
      <script type="text/javascript">
                              document.write('<tr><td>Source Location</td><td> ${it.sourceLocation} </td></tr>');
                              if("${it.sourceVersion}" != "") {
                                  document.write('<tr><td>Source Version</td><td> ${it.sourceVersion} </td></tr>');
                              }
                              if("${it.sourceType}" != "S3") {
                                  document.write('<tr><td>Git Clone Depth</td><td> ${it.gitCloneDepth} </td></tr>');
                              }
                              if("${it.sourceType}" == "GITHUB") {
                                  document.write('<tr><td>Report Build Status</td><td> ${it.reportBuildStatus} </td></tr>');
                              }
                          </script>
      ----
      
      == Inline Script Block
      Line: 115
      ----
      <script type="text/javascript">
                      if("${it.errorPhaseType}" != "") {
                          document.write('<br/>');
                          document.write('<table class="pane bigtable stripped-odd">');
                          document.write('<tbody>');
                          document.write('<tr style="border-top: 0px;"><td>' +
                          'Error in phase ' + '${it.errorPhaseType}' + ': ' + '${it.phaseErrorMessage}' + '</td></tr>');
                          document.write("</tbody></table>");
                      }
                  </script>
      ----
      
      == Inline Script Block
      Line: 127
      ----
      <script type="text/javascript">
                      if("${it.buildStatus}" == "SUCCEEDED") {
                          if("${it.s3ArtifactURL}" != "") {
                              if("${it.artifactTypeOverride}" != "NO_ARTIFACTS") {
                                  document.write('<h2>Build Artifacts</h2>');
                                  document.write('<table class="pane bigtable stripped-odd">');
                                  document.write('<tbody>');
                                  document.write('<tr align="left"><th>S3</th></tr>');
                                  document.write('<tr style="border-top: 0px;"><td>' +
                                          '<a href="' + '${it.s3ArtifactURL}' + '">' + '${it.s3BucketName}' + '</a>' + '</td></tr>');
                                  document.write("</tbody></table>");
                              }
                          }
                      }
                  </script>
      ----
      
      == Inline Script Block
      Line: 144
      ----
      <script type="text/javascript">
                      if("${it.s3LogsURL}" != "") {
                          document.write('<h2><a href="${it.s3LogsURL}" target="_blank">S3 logs</a></h2>');
                      }
                      if("${it.cloudWatchLogsURL}" != "") {
                          document.write('<h2><a href="${it.cloudWatchLogsURL}" target="_blank">CloudWatch Logs</a></h2>');
                      }
      
                      if("${it.s3LogsURL}" == "") {
                        if("${it.cloudWatchLogsURL}" == "") {
                          document.write('<br />');
                        }
                      }
                  </script>
      ----
      

      Solution

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: