GithubHelp home page GithubHelp logo

gradle-slack-plugin's People

Contributors

denuno avatar jongyoul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gradle-slack-plugin's Issues

Use lazy-evaluation for message properties

You should allow for the elements in Message to be lazy-evaluated. This allows evolving state to be included. For instance you can rewrite Message.channel to be

void setChannel(Object o) {
    this.channel = o
}

String getChannel() {
   StringUtils.stringize(this.channel)
}

private Object channel

IN this way plugin authors can for instance select the channel dependent on the result

slack {
   message {
      channel = { -> tasks.getByName('build').state.failure ? '#failed_build; : '#passed_build' }
   }
} 

You can get the StringUtils.stringize method from the Grolifant library (https://ysb33rOrg.gitlab.io/grolifant)

Something wrong: 404, ResponseEntityProxy{[Content-Type: text/html,Chunked: true]}

Recently this plugin has stopped working. The build doesn't fail, but it doesn't publish to Slack and instead we see this in the console output:

01:30:06.408 [ERROR] [net.madeng.gradle.plugin.slack.SlackTask] Something wrong: 404, ResponseEntityProxy{[Content-Type: text/html,Chunked: true]}

Here's the full debug output with a few key things redacted:

01:30:06.180 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Task :publishToSlack' started
01:30:06.180 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Putting task artifact state for task ':publishToSlack' into context took 0.0 secs.
01:30:06.180 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ':publishToSlack' is up-to-date
01:30:06.181 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Task ':publishToSlack' is not up-to-date because:
  Task has not declared any outputs despite executing actions.
01:30:06.181 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':publishToSlack'.
01:30:06.181 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Build operation 'Execute publishToSlack for :publishToSlack' started
01:30:06.182 [DEBUG] [net.madeng.gradle.plugin.slack.SlackTask] message: {"attachments":[{"color":"good","fields":[{"title":"xxxxxxxxx","value":"`xxxxxxxxx`","short":true},{"title":"GroupId","value":"`xxxxx`","short":true},{"title":"ArtifactId","value":"`xxxxxxxx`","short":true},{"title":"Version","value":"`1.0.8`","short":true}],"actions":[],"ts":1542187806}],"channel":"#new-artifacts","text":"*Published new artifact to Maven repo.*"}
01:30:06.184 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: default
01:30:06.184 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
01:30:06.185 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection request: [route: {s}->https://hooks.slack.com:443][total kept alive: 0; route allocated: 0 of 2; total allocated: 0 of 20]
01:30:06.185 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection leased: [id: 3][route: {s}->https://hooks.slack.com:443][total kept alive: 0; route allocated: 1 of 2; total allocated: 1 of 20]
01:30:06.186 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {s}->https://hooks.slack.com:443
01:30:06.186 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to hooks.slack.com/13.33.226.131:443
01:30:06.186 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Connecting socket to hooks.slack.com/13.33.226.131:443 with timeout 0
01:30:06.221 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled protocols: [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1]
01:30:06.221 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled cipher suites:[TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384, TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_RSA_WITH_AES_256_CBC_SHA, TLS_DHE_DSS_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_EMPTY_RENEGOTIATION_INFO_SCSV]
01:30:06.221 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Starting handshake
01:30:06.298 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Secure session established
01:30:06.298 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  negotiated protocol: TLSv1.2
01:30:06.298 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  negotiated cipher suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
01:30:06.300 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  peer principal: CN=slack.com, O="Slack Technologies, Inc.", L=San Francisco, ST=CA, C=US
01:30:06.300 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  peer alternative names: [slack.com, *.slack.com]
01:30:06.302 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  issuer principal: CN=DigiCert SHA2 Secure Server CA, O=DigiCert Inc, C=US
01:30:06.304 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connection established 10.1.64.23:61602<->13.33.226.131:443
01:30:06.304 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request POST /services/Txxxxxxx/Bxxxxxxxx/xxxxxxxxxxxxxxxxxx HTTP/1.1
01:30:06.304 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Target auth state: UNCHALLENGED
01:30:06.304 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Proxy auth state: UNCHALLENGED
01:30:06.408 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Connection can be kept alive indefinitely
01:30:06.408 [ERROR] [net.madeng.gradle.plugin.slack.SlackTask] Something wrong: 404, ResponseEntityProxy{[Content-Type: text/html,Chunked: true]}
01:30:06.408 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationExecutor] Completing Build operation 'Execute publishToSlack for :publishToSlack'

Using this with other gradle tests, like testing

I have a setup like this:

test {
    // Use TestNG for unit tests
    useTestNG()
}

slack {
  webhookUrl '<webhook>'
  message {
    text = "Test *hello world*"
    channel = '#ins-alerts'
    attachment {
      authorName = 'hello'
      color = 'good'
      title = "Branch: test"
      titleLink = "https://github.com/link/i/want/to/redirect"
      field {
        title = 'Built'
        value = 'Success'
        shortValue = true
      }
      field {
        title = 'Deployed'
        value = 'Success'
        shortValue = true
      }
      action {
        name = 'game'
        text = 'Chess'
        type = "button"
        value = "chess"
      }
      action {
        name = 'game'
        text = 'Thermonuclear War'
        style = 'danger'
        type = 'button'
        value = 'war'
        confirm {
           title = 'Are you sure?'
           text = 'Wouldn\'t you prefer a good game of chess?'
           okText = 'Yes'
           dismissText = 'No'
        }
      }    
    }
  }
}

I would like to feed test results into this slack plugin, how I do I do that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.