arbourd / concourse-slack-alert-resource Goto Github PK
View Code? Open in Web Editor NEWA structured Slack notification resource for Concourse
Home Page: https://hub.docker.com/r/arbourd/concourse-slack-alert-resource/
License: MIT License
A structured Slack notification resource for Concourse
Home Page: https://hub.docker.com/r/arbourd/concourse-slack-alert-resource/
License: MIT License
Hi,
Recently, my team have to migrate our Concourse notification from Slack to Google Chat. Based on your high quality codes, I can easily implement the notification resource for Google Chat. What do you think of adding an additional backend to concourse-slack-alert-resource
? I've already implemented a prototype in https://github.com/higuoxing/concourse-google-chat-alert-resource.
It looks like:
It would be nice to disable the resource at both a Source and Job param level.
Cuz docs are prolly useful
Hi
I believe there may be an issue with the out command
If you use the following even though a test channel exists it only send the message 'Tmessage' to the default channel
When using the message: parameter, the string does not replace the built in concourse parameters with the proper values.
ie:
- put: slack-alert
params:
alert_type: failed
message: "${BUILD_TEAM_NAME} Vault Smoke Tests Failed. Refer to the Runbooks at: none yet"
output in slack:
${BUILD_TEAM_NAME} Vault Smoke Tests Failed. Refer to the Runbooks at: none yet
The current implementation for instanced pipelines is limited to string=string key=values.
However, the documentation state that each value can be an arbitrary json data:
instance vars can hold arbitrary YAML/JSON data.
See: https://concourse-ci.org/instanced-pipelines.html
This includes arrays.
When using an array with this resource, it fails to unmarshall the $BUILD_PIPELINE_INSTANCE_VARS
:
panic: could not unmarshall $BUILD_PIPELINE_INSTANCE_VARS: {"days":["Monday","Tuesday","Wednesday","Thursday","Friday"],start_time":"08:00 PM","stop_time":"09:00 PM"}
goroutine 1 [running]:
github.com/arbourd/concourse-slack-alert-resource/concourse.NewBuildMetadata({0x0?, 0x0?})
/go/src/github.com/arbourd/concourse-slack-alert-resource/concourse/build.go:60 +0x874
main.out(0xc000176000, {0x7ffef20f0dd1, 0xe})
/go/src/github.com/arbourd/concourse-slack-alert-resource/out/main.go:140 +0xa8
main.main()
I have noticed that other implementation (such as https://github.com/mockersf/concourse-slack-notifier) do this differently and handle it well.
There is an ongoing PR mockersf/concourse-slack-notifier#86 about this topic.
Since both this project and mockersf/concourse-slack-notifier
seemed to have lost interest from their maintainers, I have a forked, updated version with instance var support here:
makohoek/concourse-slack-notifier#5
Note that I would prefer to fix arbourd/concourse-slack-alert-resource
but I have no Go experience at all.
Classic Dylan
Hey folks,
I haven't used Concourse for almost 3 years and keeping this up-to-date can be a bit of a problem.
Would anyone who uses this resource regularly like to take over some of the maintenance?
There are a few different resources out there for interacting with slack, but I like the format of yours the best. Unfortunately I can't use it because it doesn't have an option to skip SSL verification, and my company only ever likes to sign things internally which causes SSL verification to fail. I will take a look if I can add a pull request for this myself, but honestly I'm not much of a web guy, so we'll see what I can do.
Is there anyway to add alerts to all the tasks in a pipeline?
There is an issue with the new experimental Concourse Instanced Pipelines/Instance Groups, when the slack-alert resource tries to get the previous build status it fails with error getting last build status: error requesting Concourse build status: unexpected status code: 404
The instanced pipelines include instance vars as additional query parameters to the one and the same pipeline path e.g. https://ci.example.com/teams/development/pipelines/docker-images-build/jobs/build-something/builds/8?vars.instance=%22master%22&vars.team=%22common%22
, apparently the instance parameters are not used when the slack-alert checks the previous build status.
There is a new $BUILD_PIPELINE_INSTANCE_VARS available for custom resources as metadata that should be used when querying for prev build status.
$BUILD_PIPELINE_INSTANCE_VARS
The instance vars of the instanced pipeline that the build's job lives in, serialized as JSON. See Grouping Pipelines for a definition of instanced pipelines.
I want to notify certain users only based on the job name that failed. I tried using the message field like this
on_failure:
put: notify
params:
alert_type: failed
message: "Failed <@UDL2T4MRD>"
Although I can see I have been tagged, slack doesn't notify me ( I have notifications enabled when someone mentions my name.)
Is there a better way to do it?
I am not sure this is somehow related to the fact that i use mattermost, not slack, but when e.g. having a success message, the post does not include a link:
Any hints on how that could potentially happen - what special structure payload is used for link?
If templates #53 would be supported, i could do that with "message" myself.
Since I have updated to Concourse v6.5.1when the slack notification resources is used it fails with message "error getting last build status: error requesting Concourse build status: unexpected status code: 401".
Concourse release v6.5.0 (https://github.com/concourse/concourse/releases/tag/v6.5.0) contained breaking changes; including breaking changes affecting "custom automation built around Concourse that authenticates with the Concourse API".
Is the slack notification resource concourse authentication flow affected by the breaking change and causing the issues I am seeing?
Just leaving it here for all the people googling for that - this ressource can properly post to a mattermost incoming hook.
Dependabot can't resolve your Go dependency files.
As a result, Dependabot couldn't update your dependencies.
The error Dependabot encountered was:
dmitri.shuralyov.com/gpu/[email protected]: unrecognized import path "dmitri.shuralyov.com/gpu/mtl" (https fetch: Get https://dmitri.shuralyov.com/gpu/mtl?go-get=1: EOF)
If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.
It seems like Auth mechanism changed a bit for new versions and resource has an error when trying to authorize.
2020/05/27 08:56:32 error getting last build status: error connecting to Concourse: oauth2: cannot fetch token: 404 Not Found
Response: 404 page not found
During the running of this resource, we should log:
When the job errored
(the orange color) there are no alerts to any channel.
I am wondering if I am using the fixed
and broke
alert types correctly as there is no example anywhere or am I missing something - may be using ensure
?
I would appreciate some clarification if this is not a bug.
Here is my job definition:
- name: build-app-image
serial: true
on_success:
aggregate:
- put: team-alert
params:
alert_type: success
- put: general-alert
params:
alert_type: fixed
on_failure:
aggregate:
- put: team-alert
params:
alert_type: failed
- put: general-alert
params:
alert_type: broke
on_abort:
put: team-alert
params:
alert_type: aborted
Right now, the out
operation returns a timestamp as its version (which is inherently different every minute). This creates unnecessary records in the database and volumes (as a put
will call get
after).
Change the timestamp
version to something that does not change.
latest
should be the latest tag to prevent master branch bugs from bleeding into everyone's slack messages.
Hi team,
I am trying to use arbourd/concourse-slack-alert-resource on ARM64 architecture but it seems the arm64 tag is not available in Docker Hub.
I have successfully built the image using the command docker build -t <image_name> . on arm64 platform without any changes.
I have used buildx in Github actions to build and push the image for both platforms.
Commit Link - odidev@d28ff39
Github actions Link - https://github.com/odidev/concourse-slack-alert-resource/runs/1820414170?check_suite_focus=true
Dockerhub Link - https://hub.docker.com/repository/docker/odidev/concourse-slack-alert-resource
Please share your opinion on this. If interested, I will raise a PR.
Hi
We are getting this error quite frequently when sending notifications to slack:
wait for process completion: connection: decode failed: read tcp 127.0.0.1:49532->127.0.0.1:45955: read: connection reset by peer
I understand connection reset by peer
occurs when when a peer (the other end) unexpectedly closes the underlying connection. But i'm simply wondering if there is a way to configure retries when this occurs. Thanks in advance.
We're using instanced pipelines to handle PRs and the alert resource sends fixed for every job in the new instance of our pipeline
Per documentation:
Fixed is a special alert type that only alerts if the previous build did not succeed.
Can we change fixed to ignore the unknown state (no previous builds) or at least add a param to ignore new jobs?
Auth flow has changed to remove basic auth. Now, teams can have local auth users. We need to detect what version of Concourse is being used, and if 4.0.0 and greater, pass different parameters.
One way to do this might be to use fly
directly, like the official Concourse Pipeline resource does, but this resource really only makes one call to the ATC's API so perhaps its overkill. ๐ค
Note: support for 4.0 is only for fixed
or broke
alert types.
When I add the resource_type:
- name: slack-alert
type: docker-image
source:
repository: arbourd/concourse-slack-alert-resource
Concourse will, by default, pull the image tagged as latest
. In this case latest
is synonymous with v0.4.0
. That release was made on 5th July.
The README describes the ability to set disable: true
on source, like so:
- name: slack
type: slack-alert
source:
url: ((slack-inbound-webhook))
disable: true
But this feature was added in master on 10th July and is only present in the master
-tagged image.
My suggestion is to cut a v0.5.0
release, so that the README is in sync with behaviour.
Like in the hipchat or other slack resources ( cloudfoundry ) there are usually some interesting variables you would like to see expaneded in the message.
One could construct custom links like
/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
What do you think? Thanks
Hi All,
I was using this excellent concourse resource on a Concourse 5.x deployment, but after moving to a Concourse 6.0.0 deployment, the username / password login when using fixed / broke notifications started failing.
I ensured that I have a local user in the concourse deployment, and has access to the team.
I can login using fly login using local user, however when running in CI I get:
2020/09/11 14:50:36 error getting last build status: error connecting to Concourse: oauth2: cannot fetch token: 401 Unauthorized
Response: {"error":"invalid_client","error_description":"Invalid client credentials."}
I have tried latest tag and tag for when started supporting Concourse v6.0.
I also pulled the code for the project and looked at isolating the call to login using the creds,
and I see where it is failing when doing the oauth Password Credentials call
https://github.com/arbourd/concourse-slack-alert-resource/blob/master/concourse/client.go#L96
I'm not sure if I missed something or if anyone else has encountered this recently?
Note, I could be missing something in the v6 concourse deploy but local user login seems to work fine from the fly CLI
Cheers
Seeing this when using v0.14.1 of the resource in Concourse 7
error getting last build status: error connecting to Concourse: oauth2: cannot fetch token: 404 Not Found
Response: 404 page not found
Hi,
we're using an oauth2 provider for our authentication of our teams/members.
It seems the authentication for the fixed/broke notifications does not work. We're getting:
2020/01/21 12:22:55 error getting last build status: error connecting to Concourse: oauth2: cannot fetch token: 401 Unauthorized
Response:
Yes: Reponse is empty. Logging says:
{"timestamp":"2020-01-21T12:22:55.008878894Z","level":"error","source":"atc","message":"atc.sky.token.failed-to-fetch-dex-token","data":{"error":"oauth2: cannot fetch token: 401 Unauthorized\nResponse: {\"error\":\"access_denied\",\"error_description\":\"Invalid username or password\"}","session":"7.5653"}} {"timestamp":"2020-01-21T12:22:55.015407688Z","level":"error","source":"atc","message":"atc.sky.token.invalid-basic-auth","data":{"session":"7.5654"}}
Do you have an Idea how to solve that or du debug it better?
Thanks,
Felix
I'm attempting to use this resource to send error notifications to slack whenever a pipeline fails, but doing so results in version is missing from previous step
. Am I doing something wrong here?
My pipeline yaml:
---
resource_types:
- name: slack-notifier
type: docker-image
source:
repository: arbourd/concourse-slack-alert-resource
tag: v0.16.2
resources:
# Other resources here...
- name: notify
type: slack-notifier
source:
url: https://hooks.slack.com/services/... # devops_alerts
jobs:
- name: mfa-iam-report
plan:
- task: mfa-iam-report
config:
run: exit 1 # This job should fail so that the failure notification should go to slack
on_failure:
put: notify
params:
alert_type: failed
FWIW, this is my first usage of arbourd/concourse-slack-alert-resource
, but not my first usage of a slack notification resource. Previously we used another community resource, but that resource is now unmaintained and so we are switching over to this resource. Previously, we had this other one which also used the slack-notifier
name:
resource_types:
- name: slack-notifier
type: docker-image
source:
repository: mockersf/concourse-slack-notifier
I suppose it's possible that there could be some leftover artifact from the old usage in Concourse's database or something, but I did also kill our Concourse server and let its ASG build a new server from scratch, so any cache of Docker images or something should now be gone.
When using the :latest
image, it is broken for me:
ailed to pull image arbourd/concourse-slack-alert-resource@sha256:0ae8529b5f9bfd2a0be018b0420e54ed89a16e435a6a510af66f31bc1a7f3415.
resource script '/opt/resource/in [/tmp/build/get]' failed: exit status 1
Are some layers broken or something - not sure how this cold potentially happen. Using :master
was no problem though
It would be cool to see the version of the service with the build number instead of the concourse build number.
Instead of build number, it would be great to see the semver.buildnumber.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.