Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GHA workflows to avoid warnings around output APIs #727

Closed
simonbasle opened this issue Oct 25, 2022 · 1 comment
Closed

Update GHA workflows to avoid warnings around output APIs #727

simonbasle opened this issue Oct 25, 2022 · 1 comment
Labels
area/all-projects issues that are transverse to all projects, epics

Comments

@simonbasle
Copy link
Member

simonbasle commented Oct 25, 2022

See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

There is also a push to switch to the latest supported NodeJS runtime (node16), with some actions still using the older EoL version of the runtime.

In the current build and workflows, several classes of warnings arise:

  1. use of echo-based set-output by our build
  2. use of echo-based output or deprecated APIs by actions
  3. use of a runtime < node16 by actions

Thus there is a need to upgrade actions to the latest releases, as well as to alter the builds to use file-based output rather than echo-based output to eg. set the version type and full version parameters for further jobs.

In the gradle builds, there is also a need to reorder the output so that:

• BAD version is detected before any output and fails the job
• only one version/versionType is outputted when there are multiple modules (eg. the reactor-core one should take precedence over reactor-core-micrometer)

That last part is especially important in 2022.0.0 with the introduction of two submodules in reactor-core and reactor-pool respectively (both have a separate version number).

Example of build change

⚠️ note reactor-pool at the end of qualifyVersionGha. otherwise this code can be copy-pasted in different projects.

static def outputToGha(String versionType, String fullVersion) {
	def ghaFilename = System.getenv("GITHUB_OUTPUT")
	if (ghaFilename == null) {
		println "::set-output name=versionType::$versionType"
		println "::set-output name=fullVersion::$fullVersion"
	}
	else {
		println "using GITHUB_OUTPUT file"
		def ghaFile = new File(ghaFilename)
		ghaFile.withWriterAppend {
			it.newLine()
			it.append("versionType=$versionType")
			it.newLine()
			it.append("fullVersion=$fullVersion")
		}
	}
}

task qualifyVersionGha() {
	doLast {
		def versionType = qualifyVersion("$version")
		//we ensure that if at least _one_ submodule version is BAD, we only output versionType=BAD + job fails
		if (versionType == "BAD") {
			outputToGha(versionType, version)
			println "::error ::Unable to parse $version to a VersionNumber with recognizable qualifier"
			throw new TaskExecutionException(tasks.getByName("qualifyVersionGha"), new IllegalArgumentException("Unable to parse $version to a VersionNumber with recognizable qualifier"))
		}
		println "Recognized $version as $versionType"

		//only output the versionType and fullVersion for the main artifact
		if (project.name == 'reactor-pool') {
			outputToGha(versionType, version)
		}
	}
}
@simonbasle simonbasle added the area/all-projects issues that are transverse to all projects, epics label Oct 25, 2022
simonbasle added a commit to reactor/reactor-core that referenced this issue Oct 25, 2022
This commit changes the way job output is defined, using the new way of
a GITHUB_OUTPUT file environment variable.

The old way of echoing strings is deprecated for sensitive elements,
including action/job output.

It also reorders the output in order to:
 - ensure BAD version is detected before any output and fails the job
 - ensure only one version/versionType is outputted when there are
 multiple modules (here, the `reactor-core` one)

Finally it updates core and gradle actions to latest versions.
This fixes warnings about deprecated output style and deprecated Node
version being still in use by these actions.

See reactor/reactor#727.
simonbasle added a commit to reactor/reactor-pool that referenced this issue Oct 25, 2022
This commit changes the way job output is defined, using the new way of
a GITHUB_OUTPUT file environment variable.

The old way of echoing strings is deprecated for sensitive elements,
including action/job output.

It also reorders the output in order to:

• ensure BAD version is detected before any output and fails the job
• ensure only one version/versionType is outputted when there are
multiple modules (here, the `reactor-pool` one)

Finally it updates core and gradle actions to latest versions.
This fixes warnings about deprecated output style and deprecated Node
version being still in use by these actions.

See reactor/reactor#727.
violetagg added a commit to reactor/reactor-netty that referenced this issue Jan 6, 2023
violetagg added a commit to reactor/reactor-netty that referenced this issue Jan 6, 2023
violetagg added a commit to reactor/reactor-addons that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-kafka that referenced this issue Jan 18, 2023
violetagg added a commit that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-kotlin-extensions that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-rabbitmq that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-addons that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-kafka that referenced this issue Jan 18, 2023
violetagg added a commit that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-kotlin-extensions that referenced this issue Jan 18, 2023
violetagg added a commit to reactor/reactor-rabbitmq that referenced this issue Jan 18, 2023
chemicL pushed a commit to reactor/reactor-core that referenced this issue Mar 7, 2023
This commit changes the way job output is defined, using the new way of
a GITHUB_OUTPUT file environment variable.

The old way of echoing strings is deprecated for sensitive elements,
including action/job output.

It also reorders the output in order to:
 - ensure BAD version is detected before any output and fails the job
 - ensure only one version/versionType is outputted when there are
 multiple modules (here, the `reactor-core` one)

Finally it updates core and gradle actions to latest versions.
This fixes warnings about deprecated output style and deprecated Node
version being still in use by these actions.

See reactor/reactor#727.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/all-projects issues that are transverse to all projects, epics
Projects
None yet
Development

No branches or pull requests

2 participants