jenkins-infra / github-reusable-workflows

Repository for reusable workflows
MIT License
1 stars 6 forks source link

Automatic CD blocked by linux agents only running `powershell.exe` in build goals of `pom.xml` #38

Open cotovanu-cristian opened 1 day ago

cotovanu-cristian commented 1 day ago

Reproduction steps

  1. In the pom.xml run a powershell script e.g:

    <execution>
    <id>Generate help files</id>
    <phase>generate-resources</phase>
    <goals>
        <goal>run</goal>
    </goals>
    <configuration>
        <target>
            <exec executable="powershell.exe">
                <arg value=".\GenerateHelpFiles.ps1 " />
            </exec>
        </target>
    </configuration>
    </execution>

    Our use case: https://github.com/jenkinsci/uipath-automation-package-plugin/blob/8b71aa4c7815988f3cc6ab9b6a6207c8d4363d49/pom.xml#L123-L129

  2. Run the cd.yaml workflow

Expected Results

Expected release to be executed

Actual Results

The release failed cause the agent did not have powershell.exe Example: https://github.com/jenkinsci/uipath-automation-package-plugin/actions/runs/11416796536/job/31768407458 chrome_zcnUwLVl44

Anything else?

In the pom.xml we run a powershell script in the build goals, but the agent building plugin for the release in the github workflow is a linux agent thus it won't be capable of building the plugin. https://github.com/jenkins-infra/github-reusable-workflows/blob/72bf2ab3d9f88287d0685cec86218b04ef226edb/.github/workflows/maven-cd.yml#L75

Another thing is that this is not happening in the Jenkins pipelines as they are building with a windows agent (e.g: https://ci.jenkins.io/job/Plugins/job/uipath-automation-package-plugin/job/develop/10/)

We have this release blocker issue, could you please provide assistance or suggest a solution on how we can solve it?

timja commented 1 day ago

I think your script is trying to localise help files as html, why not just use a jelly help file and use its built-in localisation?

cotovanu-cristian commented 1 day ago

I managed to fix this by using pwsh instead of powershell.exe. ✅ 💡 But adding the option to build on windows agents would be a nice addition.

e.g:

<execution>
    <id>Generate help files</id>
    <phase>generate-resources</phase>
    <goals>
        <goal>run</goal>
    </goals>
    <configuration>
        <target>
            <exec executable="pwsh">
                <arg value=".\GenerateHelpFiles.ps1 " />
            </exec>
        </target>
    </configuration>
</execution>
cotovanu-cristian commented 1 day ago

I think your script is trying to localise help files as html, why not just use a jelly help file and use its built-in localisation?

Could you refer an example here so I can evaluate the changes for doing so?

timja commented 1 day ago

Here's an example: https://github.com/jenkinsci/jenkins/blob/23a8ef5685573afee7e5c70762bbb3f188570305/core/src/main/resources/hudson/model/Slave/help-launcher.jelly#L29