Skip to content
This repository was archived by the owner on May 8, 2023. It is now read-only.

Aws contributes special variable definitions - #61

Draft
flin-8 wants to merge 2 commits into
mainfrom
frank/specialvardefs
Draft

Aws contributes special variable definitions#61
flin-8 wants to merge 2 commits into
mainfrom
frank/specialvardefs

Conversation

@flin-8

@flin-8 flin-8 commented Jul 6, 2020

Copy link
Copy Markdown
Contributor

Server PR: https://github.com/OctopusDeploy/OctopusDeploy/pull/6356

This includes moving IContributeSpecialVariables and ActionSpecialVariable from Server.

@flin-8
flin-8 requested a review from droyad as a code owner July 6, 2020 23:55
@flin-8 flin-8 self-assigned this Jul 6, 2020
@flin-8
flin-8 requested a review from slewis74 July 6, 2020 23:58

namespace Sashimi.Server.Contracts.Variables
{
public class ActionSpecialVariable

@slewis74 slewis74 Jul 7, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the name. These could be Action or Account or a number of other things in the future, right? Could this just be SpecialVariable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to rename this. We also have SpecialVariable on the server-side that also have a CustomBindingLabel. We could call both SpecialVariable or make the server-side one SpecialVariableDefinition?

public ActionSpecialVariable(string name, BindingBehaviour userVisible = BindingBehaviour.Visible, params string[] deprecatedAliases)
{
Name = name;
DeprecatedAliases = deprecatedAliases;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this DeprecatedAliases property?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of variables in server that have been renamed over time. The deprecated aliases contain the list of previous names, and during the deployment pipeline server will duplicate the current variable value into all of the old names as well, in case any existing scripts are using them. I.e. is for backward compat.

@andyinaus andyinaus Jul 7, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ... are we planning to/can we address this backward compact issue? If this can never be addressed somehow, maybe it should be considered as a feature here to support Aliases rather than a DeprecatedAliases as we usually use attribute-based approach for deprecation/obsolete instead of polluting the object itself to avoid any unnecessary API change of the object in the future.

}
}

public enum BindingBehaviour

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be a boolean instead? e.g. IsVisibleToUsers

@slewis74 slewis74 Jul 7, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit like TinyTypes, having the enum makes the call very clear as to what is happening and provides compile safety. new SpecialVariable("foo", BindingBehaviour.Hidden) is easier to reason about reading the calling code than new SpecialVariable("foo", false)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm ... sounds like we are trying to get rid of any usage of boolean for better readability, am I right?
Is Visibility a better name than BindingBehaviour ?

@flin-8
flin-8 force-pushed the frank/specialvardefs branch from ab62a1f to e535a49 Compare August 11, 2020 03:11
@flin-8
flin-8 marked this pull request as draft August 11, 2020 23:42
@flin-8
flin-8 changed the base branch from master to main October 20, 2020 00:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants