Skip to content

Commit 625160b

Browse files
authored
Disable set-env and add-pathcommands (actions#779)
* Disable Old Runner Commands set-env and add-path * update dotnet install scripts * update runner version and release notes
1 parent a729a0a commit 625160b

File tree

6 files changed

+216
-264
lines changed

6 files changed

+216
-264
lines changed

releaseNote.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
- N/A
66

77
## Misc
8-
- Add deprecation date to add-path and set-env runner commands (#796)
8+
- Disabled add-path and set-env runner commands (#779)
9+
- Updated dotnet install scripts (#779)
910

1011
## Windows x64
1112
We recommend configuring the runner in a root folder of the Windows drive (e.g. "C:\actions-runner"). This will help avoid issues related to service identity folder permissions and long file path restrictions on Windows.

src/Misc/dotnet-install.ps1

Lines changed: 190 additions & 183 deletions
Large diffs are not rendered by default.

src/Misc/dotnet-install.sh

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -241,42 +241,6 @@ check_min_reqs() {
241241
return 0
242242
}
243243

244-
check_pre_reqs() {
245-
eval $invocation
246-
247-
if [ "${DOTNET_INSTALL_SKIP_PREREQS:-}" = "1" ]; then
248-
return 0
249-
fi
250-
251-
if [ "$(uname)" = "Linux" ]; then
252-
if is_musl_based_distro; then
253-
if ! command -v scanelf > /dev/null; then
254-
say_warning "scanelf not found, please install pax-utils package."
255-
return 0
256-
fi
257-
LDCONFIG_COMMAND="scanelf --ldpath -BF '%f'"
258-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libintl)" ] && say_warning "Unable to locate libintl. Probable prerequisite missing; install libintl (or gettext)."
259-
else
260-
if [ ! -x "$(command -v ldconfig)" ]; then
261-
say_verbose "ldconfig is not in PATH, trying /sbin/ldconfig."
262-
LDCONFIG_COMMAND="/sbin/ldconfig"
263-
else
264-
LDCONFIG_COMMAND="ldconfig"
265-
fi
266-
local librarypath=${LD_LIBRARY_PATH:-}
267-
LDCONFIG_COMMAND="$LDCONFIG_COMMAND -NXv ${librarypath//:/ }"
268-
fi
269-
270-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep zlib)" ] && say_warning "Unable to locate zlib. Probable prerequisite missing; install zlib."
271-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep ssl)" ] && say_warning "Unable to locate libssl. Probable prerequisite missing; install libssl."
272-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libicu)" ] && say_warning "Unable to locate libicu. Probable prerequisite missing; install libicu."
273-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep lttng)" ] && say_warning "Unable to locate liblttng. Probable prerequisite missing; install liblttng."
274-
[ -z "$($LDCONFIG_COMMAND 2>/dev/null | grep libcurl)" ] && say_warning "Unable to locate libcurl. Probable prerequisite missing; install libcurl."
275-
fi
276-
277-
return 0
278-
}
279-
280244
# args:
281245
# input - $1
282246
to_lowercase() {
@@ -468,7 +432,6 @@ parse_jsonfile_for_version() {
468432
sdk_list=$(echo $sdk_section | awk -F"[{}]" '{print $2}')
469433
sdk_list=${sdk_list//[\" ]/}
470434
sdk_list=${sdk_list//,/$'\n'}
471-
sdk_list="$(echo -e "${sdk_list}" | tr -d '[[:space:]]')"
472435

473436
local version_info=""
474437
while read -r line; do
@@ -588,14 +551,20 @@ get_specific_product_version() {
588551
return 1
589552
fi
590553

591-
specific_product_version=$(curl -s --fail "$download_link")
592-
if [ $? -ne 0 ]
554+
if machine_has "curl"
555+
then
556+
specific_product_version=$(curl -s --fail "$download_link")
557+
if [ $? -ne 0 ]
558+
then
559+
specific_product_version=$specific_version
560+
fi
561+
elif machine_has "wget"
593562
then
594-
specific_product_version=$(wget -qO- "$download_link")
595-
if [ $? -ne 0 ]
596-
then
597-
specific_product_version=$specific_version
598-
fi
563+
specific_product_version=$(wget -qO- "$download_link")
564+
if [ $? -ne 0 ]
565+
then
566+
specific_product_version=$specific_version
567+
fi
599568
fi
600569
specific_product_version="${specific_product_version//[$'\t\r\n']}"
601570

@@ -1098,6 +1067,11 @@ if [ "$no_cdn" = true ]; then
10981067
azure_feed="$uncached_feed"
10991068
fi
11001069
1070+
say "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
1071+
say "- The SDK needs to be installed without user interaction and without admin rights."
1072+
say "- The SDK installation doesn't need to persist across multiple CI runs."
1073+
say "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n"
1074+
11011075
check_min_reqs
11021076
calculate_vars
11031077
script_name=$(basename "$0")
@@ -1119,7 +1093,6 @@ if [ "$dry_run" = true ]; then
11191093
exit 0
11201094
fi
11211095
1122-
check_pre_reqs
11231096
install_dotnet
11241097
11251098
bin_path="$(get_absolute_path "$(combine_paths "$install_root" "$bin_folder_relative_path")")"
@@ -1130,4 +1103,6 @@ else
11301103
say "Binaries of dotnet can be found in $bin_path"
11311104
fi
11321105
1106+
say "Note that the script does not resolve dependencies during installation."
1107+
say "To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."
11331108
say "Installation finished successfully."

src/Runner.Common/Constants.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ public static class ReturnCode
141141
public static readonly string InternalTelemetryIssueDataKey = "_internal_telemetry";
142142
public static readonly string WorkerCrash = "WORKER_CRASH";
143143
public static readonly string UnsupportedCommand = "UNSUPPORTED_COMMAND";
144-
public static readonly string UnsupportedCommandMessage = "The `{0}` command is deprecated and will be disabled on November 16th. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/";
145144
public static readonly string UnsupportedCommandMessageDisabled = "The `{0}` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/";
146145
}
147146

src/Runner.Worker/ActionCommandManager.cs

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,6 @@ public sealed class SetEnvCommandExtension : RunnerService, IActionCommandExtens
184184

185185
public void ProcessCommand(IExecutionContext context, string line, ActionCommand command, ContainerInfo container)
186186
{
187-
var configurationStore = HostContext.GetService<IConfigurationStore>();
188-
var isHostedServer = configurationStore.GetSettings().IsHostedServer;
189-
190187
var allowUnsecureCommands = false;
191188
bool.TryParse(Environment.GetEnvironmentVariable(Constants.Variables.Actions.AllowUnsupportedCommands), out allowUnsecureCommands);
192189

@@ -201,22 +198,10 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
201198
bool.TryParse(envContext[Constants.Variables.Actions.AllowUnsupportedCommands].ToString(), out allowUnsecureCommands);
202199
}
203200

204-
// TODO: Eventually remove isHostedServer and apply this to dotcom customers as well
205-
if (!isHostedServer && !allowUnsecureCommands)
201+
if (!allowUnsecureCommands)
206202
{
207203
throw new Exception(String.Format(Constants.Runner.UnsupportedCommandMessageDisabled, this.Command));
208204
}
209-
else if (!allowUnsecureCommands)
210-
{
211-
// Log Telemetry and let user know they shouldn't do this
212-
var issue = new Issue()
213-
{
214-
Type = IssueType.Error,
215-
Message = String.Format(Constants.Runner.UnsupportedCommandMessage, this.Command)
216-
};
217-
issue.Data[Constants.Runner.InternalTelemetryIssueDataKey] = Constants.Runner.UnsupportedCommand;
218-
context.AddIssue(issue);
219-
}
220205

221206
if (!command.Properties.TryGetValue(SetEnvCommandProperties.Name, out string envName) || string.IsNullOrEmpty(envName))
222207
{
@@ -339,10 +324,7 @@ public sealed class AddPathCommandExtension : RunnerService, IActionCommandExten
339324
public Type ExtensionType => typeof(IActionCommandExtension);
340325

341326
public void ProcessCommand(IExecutionContext context, string line, ActionCommand command, ContainerInfo container)
342-
{
343-
var configurationStore = HostContext.GetService<IConfigurationStore>();
344-
var isHostedServer = configurationStore.GetSettings().IsHostedServer;
345-
327+
{
346328
var allowUnsecureCommands = false;
347329
bool.TryParse(Environment.GetEnvironmentVariable(Constants.Variables.Actions.AllowUnsupportedCommands), out allowUnsecureCommands);
348330

@@ -357,22 +339,10 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand
357339
bool.TryParse(envContext[Constants.Variables.Actions.AllowUnsupportedCommands].ToString(), out allowUnsecureCommands);
358340
}
359341

360-
// TODO: Eventually remove isHostedServer and apply this to dotcom customers as well
361-
if (!isHostedServer && !allowUnsecureCommands)
342+
if (!allowUnsecureCommands)
362343
{
363344
throw new Exception(String.Format(Constants.Runner.UnsupportedCommandMessageDisabled, this.Command));
364345
}
365-
else if (!allowUnsecureCommands)
366-
{
367-
// Log Telemetry and let user know they shouldn't do this
368-
var issue = new Issue()
369-
{
370-
Type = IssueType.Error,
371-
Message = String.Format(Constants.Runner.UnsupportedCommandMessage, this.Command)
372-
};
373-
issue.Data[Constants.Runner.InternalTelemetryIssueDataKey] = Constants.Runner.UnsupportedCommand;
374-
context.AddIssue(issue);
375-
}
376346

377347
ArgUtil.NotNullOrEmpty(command.Data, "path");
378348
context.Global.PrependPath.RemoveAll(x => string.Equals(x, command.Data, StringComparison.CurrentCulture));

src/runnerversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.274.1
1+
2.274.2

0 commit comments

Comments
 (0)