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

Build actions only work with ubuntu #513

Open
marohrdanz opened this issue Jun 21, 2023 · 3 comments
Open

Build actions only work with ubuntu #513

marohrdanz opened this issue Jun 21, 2023 · 3 comments

Comments

@marohrdanz
Copy link
Contributor

We have several GitHub Action workflows to build artifacts from this repository. For unknown reasons, they only work with

runs-on: ubuntu-<version or 'latest'>

On both macOS and windows, an error occurs when running ant -f build_ngchmApp.xml in the target create_server_app_dir. The code appears to be reading in file custom.js as a string, and crashes when it gets to the part of the string:

logo: "https://www.cbioportal.org/images/cbioportal_logo.png",

Because this part contains the substrings "images/" and ".png", the function CompilerUtilities.copyLineAndImages() attempts to copy a file "cbioportal_logo.png", which of course doesn't exist in our repo. Here is that function for quick reference:

public static void copyLineAndImages (String line, String inputDir, String outputDir)
        throws Exception
{   
        if (line.contains("images/")) {
                // Copy any images on line to output directory.
                String toks[] = line.split(" ");
                for (String tok : toks) {
                        if (tok.contains("images/")) {
                                int start = tok.indexOf("images/");
                                int stop = tok.indexOf(".png");
                                String fileName;
                                if (start < 0 || stop < 0) {
                                        System.out.println ("Bad image string: '" + tok + "' on line " + line);
                                }   
                                stop = stop + 4;  // Stop at end of .png
                                fileName = tok.substring(start,stop);
                                if (!imageFiles.contains(fileName)) {
                                        System.out.println("Copying image file " + fileName);
                                         CompilerUtilities.copyFile (inputDir + "/" + fileName, outputDir + "/" + fileName)
                                        imageFiles.add (fileName);
                                        imageCounts.add (0);
                                }   
                                int idx = imageFiles.indexOf(fileName);
                                imageCounts.set (idx, imageCounts.get (idx) + 1); 
                        }   
                }   
        }   
}   

A few mysteries:

  • Why is the code even trying to read 'custom.js'? That was not the intent of the original authors.
  • Why does the issue occur on macOS and windows, but not on linux (tested on ubuntu and RedHat)?

As a stab in the dark, we wondered if updating the closure compiler jar file would address the issue. I tried updating from closure-compiler-v20200204.jar -> closure-compiler-v20230502.jar, and compiling with the required java 11. However the issue remains.

@jmelott
Copy link

jmelott commented Jun 21, 2023

In addition to the issues mentioned above, perhaps the code shouldn't be including anything with an image with an absolute URL?
Maybe
if (tok.contains("images/")) {
should be
if (tok.contains("images/") && !tok.startsWith("http")) {

@jmelott
Copy link

jmelott commented Jun 21, 2023

I looked around an noticed that different people were having issues a recently with code sometimes not being run on ubuntu systems after some changes on github's side regarding which builds are being used for the runners.
actions/runner-images#7733

Is there anything in our action that we can use to verify that that code is actually being run when we use the runs-on: ubuntu-<version or 'latest'> setting. Perhaps the code should be failing consistently for all systems, but it just isn't actually being run on the ubuntu system at all so therefore we don't get an error from it?

@marohrdanz
Copy link
Contributor Author

@jmelott we can look into it. For reference: ant -f build_ngchmApp.xml runs just fine manually on RedHat linux also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants