Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can i add tagged versions into the message of slack notify

Sri Karan
Contributor
January 9, 2020

Hi team,

 

I am trying to use the slack notify pipeline to send custom messages on my pipeline build and i want to add the tagged versions of my pipeling in the messages can you please help me with how i can do that i am using slack notify version 0.3.3

1 answer

1 accepted

2 votes
Answer accepted
Viktoriia Kozopas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 10, 2020

Hi @Sri Karan ,
Could you please provide more details on what do you mean by "tagged versions of my pipeling"? Do you mean BITBUCKET_BUILD_NUMBER?

Sri Karan
Contributor
January 12, 2020

Hi @Viktoriia Kozopas we are using semtag to tag our build versions and want to send custom messages to slack with the version details.

Viktoriia Kozopas
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2020

I guess I understand what you need. 

To share the data between steps you may use artifacts that you configure in the pipeline. You may create the file to save data (in your case - version number) and then share it with the following step (for example - in the message variable of the slack-notify pipe).

In bitbucket-pipelines.yml it may look something like this:

pipelines:

  default:

    - step:

        # ... previous steps ...

        script:

          - semtag getcurrent > ./version.txt # write version to file

        artifacts:

          - version.txt

   - step:

        script:

          - pipe: atlassian/slack-notify:0.3.3

            variables:

              WEBHOOK_URL: $WEBHOOK_URL

              MESSAGE: $(cat ./version.txt)


Hope this helps. Please, let us know if you have any questions. 

Like Sri Karan likes this
Sri Karan
Contributor
January 13, 2020

@Viktoriia Kozopas  Thanks for your response will give it a try and let you know if i need further help on this.

Like # people like this
Sri Karan
Contributor
January 27, 2020

@Viktoriia Kozopas Can we add failure notification to slack as well using the slack notify pipeline?

Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 28, 2020

@Sri Karan  you can use $BITBUCKET_EXIT_CODE variable .

And add Slack notify pipe  to the after-script section in the step similar to this question.

Like Sri Karan likes this
Sri Karan
Contributor
January 30, 2020

@Oleksandr Kyrdan  Thanks for the update i will test the same and get back to you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events