Skip to content

Commit

Permalink
Merge pull request #997 from Jericho/remove_gitter
Browse files Browse the repository at this point in the history
Remove Gitter
  • Loading branch information
gep13 committed May 2, 2024
2 parents 30f4aee + 2639bf0 commit 513af36
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 142 deletions.
1 change: 0 additions & 1 deletion Source/Cake.Recipe/Content/addins.cake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#addin nuget:?package=Cake.Coverlet&version=2.5.4
#addin nuget:?package=Portable.BouncyCastle&version=1.8.5
#addin nuget:?package=Cake.Email&version=2.0.0&loaddependencies=true
#addin nuget:?package=Cake.Gitter&version=2.0.0
#addin nuget:?package=Cake.Incubator&version=7.0.0
#addin nuget:?package=Cake.Kudu&version=2.0.0
#addin nuget:?package=Cake.MicrosoftTeams&version=2.0.0
Expand Down
5 changes: 0 additions & 5 deletions Source/Cake.Recipe/Content/build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ Teardown<BuildVersion>((context, buildVersion) =>
SendMessageToTwitter(string.Format(BuildParameters.TwitterMessage, messageArguments));
}
if (BuildParameters.CanPostToGitter && BuildParameters.ShouldPostToGitter)
{
SendMessageToGitterRoom(string.Format(BuildParameters.GitterMessage, messageArguments));
}
if (BuildParameters.CanPostToMicrosoftTeams && BuildParameters.ShouldPostToMicrosoftTeams)
{
SendMessageToMicrosoftTeams(string.Format(BuildParameters.MicrosoftTeamsMessage, messageArguments));
Expand Down
19 changes: 0 additions & 19 deletions Source/Cake.Recipe/Content/credentials.cake
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ public class EmailCredentials
}
}

public class GitterCredentials
{
public string Token { get; private set; }
public string RoomId { get; private set; }

public GitterCredentials(string token, string roomId)
{
Token = token;
RoomId = roomId;
}
}

public class SlackCredentials
{
public string Token { get; private set; }
Expand Down Expand Up @@ -175,13 +163,6 @@ public static MicrosoftTeamsCredentials GetMicrosoftTeamsCredentials(ICakeContex
context.EnvironmentVariable(Environment.MicrosoftTeamsWebHookUrlVariable));
}

public static GitterCredentials GetGitterCredentials(ICakeContext context)
{
return new GitterCredentials(
context.EnvironmentVariable(Environment.GitterTokenVariable),
context.EnvironmentVariable(Environment.GitterRoomIdVariable));
}

public static SlackCredentials GetSlackCredentials(ICakeContext context)
{
return new SlackCredentials(
Expand Down
6 changes: 0 additions & 6 deletions Source/Cake.Recipe/Content/environment.cake
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
public static class Environment
{
public static string GithubTokenVariable { get; private set; }
public static string GitterTokenVariable { get; private set; }
public static string GitterRoomIdVariable { get; private set; }
public static string SlackTokenVariable { get; private set; }
public static string SlackChannelVariable { get; private set; }
public static string TwitterConsumerKeyVariable { get; private set; }
Expand All @@ -25,8 +23,6 @@ public static class Environment

public static void SetVariableNames(
string githubTokenVariable = null,
string gitterTokenVariable = null,
string gitterRoomIdVariable = null,
string slackTokenVariable = null,
string slackChannelVariable = null,
string twitterConsumerKeyVariable = null,
Expand All @@ -48,8 +44,6 @@ public static class Environment
string wyamDeployBranchVariable = null)
{
GithubTokenVariable = githubTokenVariable ?? "GITHUB_PAT";
GitterTokenVariable = gitterTokenVariable ?? "GITTER_TOKEN";
GitterRoomIdVariable = gitterRoomIdVariable ?? "GITTER_ROOM_ID";
SlackTokenVariable = slackTokenVariable ?? "SLACK_TOKEN";
SlackChannelVariable = slackChannelVariable ?? "SLACK_CHANNEL";
TwitterConsumerKeyVariable = twitterConsumerKeyVariable ?? "TWITTER_CONSUMER_KEY";
Expand Down
29 changes: 0 additions & 29 deletions Source/Cake.Recipe/Content/gitter.cake

This file was deleted.

24 changes: 0 additions & 24 deletions Source/Cake.Recipe/Content/parameters.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ public enum BranchType

public static class BuildParameters
{
private static string _gitterMessage;
private static string _microsoftTeamsMessage;
private static string _twitterMessage;
private static bool _shouldUseDeterministicBuilds;
Expand Down Expand Up @@ -60,12 +59,6 @@ public static class BuildParameters
get { return "Version {0} of the {1} Addin has just been released, this will be available here https://www.nuget.org/packages/{1}, once package indexing is complete."; }
}

public static string GitterMessage
{
get { return _gitterMessage ?? "@/all " + StandardMessage; }
set { _gitterMessage = value; }
}

public static string MicrosoftTeamsMessage
{
get { return _microsoftTeamsMessage ?? StandardMessage; }
Expand All @@ -81,7 +74,6 @@ public static class BuildParameters
public static GitHubCredentials GitHub { get; private set; }
public static MicrosoftTeamsCredentials MicrosoftTeams { get; private set; }
public static EmailCredentials Email { get; private set; }
public static GitterCredentials Gitter { get; private set; }
public static SlackCredentials Slack { get; private set; }
public static TwitterCredentials Twitter { get; private set; }
public static AppVeyorCredentials AppVeyor { get; private set; }
Expand All @@ -108,7 +100,6 @@ public static class BuildParameters
public static int TransifexPullPercentage { get; private set; }

public static bool ShouldBuildNugetSourcePackage { get; private set; }
public static bool ShouldPostToGitter { get; private set; }
public static bool ShouldPostToSlack { get; private set; }
public static bool ShouldPostToTwitter { get; private set; }
public static bool ShouldPostToMicrosoftTeams { get; private set; }
Expand Down Expand Up @@ -180,15 +171,6 @@ public static class BuildParameters
}
}

public static bool CanPostToGitter
{
get
{
return !string.IsNullOrEmpty(BuildParameters.Gitter.Token) &&
!string.IsNullOrEmpty(BuildParameters.Gitter.RoomId);
}
}

public static bool CanPostToSlack
{
get
Expand Down Expand Up @@ -287,7 +269,6 @@ public static class BuildParameters
context.Information("BranchType: {0}", BranchType);
context.Information("TreatWarningsAsErrors: {0}", TreatWarningsAsErrors);
context.Information("ShouldSendEmail: {0}", ShouldSendEmail);
context.Information("ShouldPostToGitter: {0}", ShouldPostToGitter);
context.Information("ShouldPostToSlack: {0}", ShouldPostToSlack);
context.Information("ShouldPostToTwitter: {0}", ShouldPostToTwitter);
context.Information("ShouldPostToMicrosoftTeams: {0}", ShouldPostToMicrosoftTeams);
Expand Down Expand Up @@ -353,7 +334,6 @@ public static class BuildParameters
string repositoryName = null,
string appVeyorAccountName = null,
string appVeyorProjectSlug = null,
bool shouldPostToGitter = true,
bool shouldPostToSlack = true,
bool shouldPostToTwitter = true,
bool shouldPostToMicrosoftTeams = false,
Expand All @@ -380,7 +360,6 @@ public static class BuildParameters
bool? transifexEnabled = null,
TransifexMode transifexPullMode = TransifexMode.OnlyTranslated,
int transifexPullPercentage = 60,
string gitterMessage = null,
string microsoftTeamsMessage = null,
string twitterMessage = null,
DirectoryPath wyamRootDirectoryPath = null,
Expand Down Expand Up @@ -445,7 +424,6 @@ public static class BuildParameters
TransifexPullMode = transifexPullMode;
TransifexPullPercentage = transifexPullPercentage;

GitterMessage = gitterMessage;
MicrosoftTeamsMessage = microsoftTeamsMessage;
TwitterMessage = twitterMessage;

Expand All @@ -459,7 +437,6 @@ public static class BuildParameters
WebLinkRoot = webLinkRoot ?? RepositoryName;
WebBaseEditUrl = webBaseEditUrl ?? string.Format("https://github.com/{0}/{1}/tree/{2}/docs/input/", repositoryOwner, RepositoryName, developBranchName);

ShouldPostToGitter = shouldPostToGitter;
ShouldPostToSlack = shouldPostToSlack;
ShouldPostToTwitter = shouldPostToTwitter;
ShouldPostToMicrosoftTeams = shouldPostToMicrosoftTeams;
Expand Down Expand Up @@ -606,7 +583,6 @@ public static class BuildParameters
GitHub = GetGitHubCredentials(context);
MicrosoftTeams = GetMicrosoftTeamsCredentials(context);
Email = GetEmailCredentials(context);
Gitter = GetGitterCredentials(context);
Slack = GetSlackCredentials(context);
Twitter = GetTwitterCredentials(context);
AppVeyor = GetAppVeyorCredentials(context);
Expand Down
4 changes: 2 additions & 2 deletions docs/input/assets/css/override.less
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ pre:hover .btn-copy {

@font-family-sans-serif: "Roboto", Helvetica, Arial, sans-serif;

/* For Gitter and GitHub */
/* For GitHub */
.bottom-footer {
margin-bottom: 40px !important; // Make room for Gitter and GitHub buttons
margin-bottom: 40px !important; // Make room for GitHub buttons
}

.github-button {
Expand Down
18 changes: 0 additions & 18 deletions docs/input/docs/fundamentals/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,6 @@ The Personal Access Token of the GitHub account to be used.
If `GITHUB_PAT` is not set, the alternatives of `GH_TOKEN` and `GITHUB_TOKEN` are considered.
:::

## Gitter

When a successful release build has been completed, Cake.Recipe can be configured to send out a notification (with configurable message) to a Gitter Room. There are two required environment variables that needs to be set to make this happen. Further information about find this information can be found in the Cake.Gitter [documentation](https://cake-contrib.github.io/Cake.Gitter/docs/usage/requiredinformation).

:::{.alert .alert-info}
**NOTE:**

In addition to these environment variables being present, and correct, the control variable [shouldPostToGitter](./set-parameters#shouldPostToGitter) also needs to be set to true. The default value for this parameter is true.
:::

### GITTER_TOKEN

The authentication token for the user who should post to the room.

### GITTER_ROOM_ID

The room ID where you want the message to be sent.

## Slack

When a release build fails, Cake.Recipe can be configured to send out a notification (with configurable message) to a Slack Channel. There are two required environment variables that s to be set to make this happen. Further information about find this information can be found in the Cake.Slack [documentation](https://github.com/cake-contrib/Cake.Slack).
Expand Down
1 change: 0 additions & 1 deletion docs/input/docs/fundamentals/print-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ IsTagged: False
BranchType: Develop
TreatWarningsAsErrors: True
ShouldSendEmail: True
ShouldPostToGitter: True
ShouldPostToSlack: True
ShouldPostToTwitter: True
ShouldPostToMicrosoftTeams: False
Expand Down
20 changes: 0 additions & 20 deletions docs/input/docs/fundamentals/set-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,6 @@ Default Value:
Title.Replace(".", "-").ToLower();
```

### shouldPostToGitter

This is used as a final control variable for whether or not notification messages should be posted to Gitter when the a final release build (i.e. a tagged build) completes.

Type: `bool`

Default Value:

```csharp
true
```
Expand Down Expand Up @@ -502,18 +494,6 @@ Default Value:
60
```

### gitterMessage

This is the message that is sent to Gitter at the end of a tagged build. This is formatted with the calculated version number, as well as the Title parameter.

Type: `string`

Default Value:

```csharp
@/all Version {0} of the {1} Addin has just been released, this will be available here https://www.nuget.org/packages/{1}, once package indexing is complete."
```

### microsoftTeamsMessage

This is the message that is sent to Microsoft Teams at the end of a tagged build. This is formatted with the calculated version number, as well as the Title parameter.
Expand Down
20 changes: 6 additions & 14 deletions docs/input/docs/fundamentals/set-variable-names.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ Description: Override the default names of the environment variables used by Cak

Cake.Recipe is driven by [environment variables](./environment-variables). These are used to store the sensitive information that is required during the build process. For example, the username and password needed to send email, or the token required to access GitHub.

Cake.Recipe has default environment variable names for all the pieces of information that are required. The expectation is that either locally on your own machine, or on the CI/CD pipeline that you are using, you set the values for all of the ones that you intend to use. For example, if you want to send messages to Gitter when the build succeeds, you will need to set environment variables with the names required.
Cake.Recipe has default environment variable names for all the pieces of information that are required. The expectation is that either locally on your own machine, or on the CI/CD pipeline that you are using, you set the values for all of the ones that you intend to use. For example, if you want to send messages to Slack when the build succeeds, you will need to set environment variables with the names required.

However, it may be necessary to change these environment variable names. One example of when this is required is when you might be using Cake.Recipe on two completely separate projects. In this scenario, you might need to set the Gitter Environment variables for both projects, but they may require different values.
However, it may be necessary to change these environment variable names. One example of when this is required is when you might be using Cake.Recipe on two completely separate projects. In this scenario, you might need to set the Slack Environment variables for both projects, but they may require different values.

As an example, lets say that you wanted to change the name of the environment variables that stored the Gitter credential information. You could add something like the following to your [recipe.cake](./recipe-cake) file:
As an example, lets say that you wanted to change the name of the environment variables that stored the Slack credential information. You could add something like the following to your [recipe.cake](./recipe-cake) file:

```csharp
Environment.SetVariableNames(gitterTokenVariable: "PROJECTA_GITTER_TOKEN", gitterRoomIdVariable: "PROJECTA_GITTER_ROOM_ID");
Environment.SetVariableNames(slackTokenVariable: "PROJECTA_SLACK_TOKEN", slackChannelVariable: "PROJECTA_SLACK_CHANNEL");
```

This would mean that when required, Cake.Recipe would check the machine which it is running on for environment variables names `PROJECTA_GITTER_TOKEN` and `PROJECTA_GITTER_ROOM_ID`, rather than the default of `GITTER_TOKEN` and `GITTER_ROOM_ID`.
This would mean that when required, Cake.Recipe would check the machine which it is running on for environment variables names `PROJECTA_SLACK_TOKEN` and `PROJECTA_SLACK_CHANNEL`, rather than the default of `SLACK_TOKEN` and `SLACK_CHANNEL`.

There is another scenario where you might want to override the environment variable names when running locally on your own machine, but you might want to use the default variable names when running on a CI/CD system. To facilitate that, you can do something similar to the following:

```csharp
if (BuildSystem.IsLocalBuild)
{
Environment.SetVariableNames(gitterTokenVariable: "PROJECTA_GITTER_TOKEN", gitterRoomIdVariable: "PROJECTA_GITTER_ROOM_ID");
Environment.SetVariableNames(slackTokenVariable: "PROJECTA_SLACK_TOKEN", slackChannelVariable: "PROJECTA_SLACK_CHANNEL");
}
else
{
Expand All @@ -39,14 +39,6 @@ The `SetVariableNames` method uses the concept of optional parameters, in fact,

Default value: `GITHUB_PAT`

### gitterTokenVariable

Default value: `GITTER_ROOM_ID`

### gitterRoomIdVariable

Default value: `GITTER_ROOM_ID`

### slackTokenVariable

Default value: `SLACK_TOKEN`
Expand Down
2 changes: 1 addition & 1 deletion docs/input/docs/usage/create-pre-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ which are documented [here](creating-release){.alert-link}.
6. Check the generated release notes and make required manual changes.
7. Publish the draft release on GitHub.

The last step will tag the release and trigger another build including the publishing. The build will automatically publish the build artifacts to the GitHub release, publish to NuGet and notify about the new release through Twitter and Gitter ((by default, but it is also possbile to add notifications to [Microsoft Teams](../fundamentals/environment-variables#microsoft-teams) and [email](../fundamentals/environment-variables#email))), based on your specific settings.
The last step will tag the release and trigger another build including the publishing. The build will automatically publish the build artifacts to the GitHub release, publish to NuGet and notify about the new release through Twitter ((by default, but it is also possible to add notifications to [Microsoft Teams](../fundamentals/environment-variables#microsoft-teams) and [email](../fundamentals/environment-variables#email))), based on your specific settings.
2 changes: 1 addition & 1 deletion docs/input/docs/usage/creating-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Both are not requirements though and you can adopt the steps to other environmen
7. If release is ready finish release (merge back into `master` and `develop`) but don't tag the release yet.
8. Publish the draft release on GitHub.

The last step will tag the release and trigger another build including the publishing. The build will automatically publish the build artifacts to the GitHub release, publish to NuGet and notify about the new release through Twitter and Gitter (by default, but it is also possbile to add notifications to [Microsoft Teams](../fundamentals/environment-variables#microsoft-teams) and [email](../fundamentals/environment-variables#email)), based on your specific settings.
The last step will tag the release and trigger another build including the publishing. The build will automatically publish the build artifacts to the GitHub release, publish to NuGet and notify about the new release through Twitter (by default, but it is also possible to add notifications to [Microsoft Teams](../fundamentals/environment-variables#microsoft-teams) and [email](../fundamentals/environment-variables#email)), based on your specific settings.
1 change: 0 additions & 1 deletion recipe.cake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ BuildParameters.SetParameters(context: Context,
shouldRunCoveralls: false,
shouldRunCodecov: false,
shouldRunDotNetCorePack: true,
gitterMessage: "@/all " + standardNotificationMessage,
twitterMessage: standardNotificationMessage);

BuildParameters.PrintParameters(Context);
Expand Down

0 comments on commit 513af36

Please sign in to comment.