dockerfile-image-update/src/main/java/com/salesforce/dockerfileimageupdate/utils/DockerfileGitHubUtil.java
/**
     * This method will read a line and see if the line contains a FROM instruction with the specified
     * {@code imageToFind}. If the image does not have the given {@code tag} then {@code stringBuilder}
     * will get a modified version of the line with the new {@code tag}. We return {@code true} in this
     * instance.
     *
     * If the inbound {@code line} does not qualify for changes or if the tag is already correct, the
     * {@code stringBuilder} will get {@code line} added to it. We return {@code false} in this instance.
     *
     * @param imageToFind the Docker image that may require a tag update
     * @param tag the Docker tag that we'd like the image to have
     * @param stringBuilder the stringBuilder to accumulate the output lines for the pull request
     * @param line the inbound line from the Dockerfile
     * @return Whether we've modified the {@code line} that goes into {@code stringBuilder}
     */
This method will read a line and see if the line contains a FROM instruction with the specified
imageToFind. If the image does not have the given  tag then  stringBuilder
will get a modified version of the line with the new  tag. We return  true in this
instance.

If the inbound  line does not qualify for changes or if the tag is already correct, the
stringBuilder will get  line added to it. We return  false in this instance.


This method will read a line and see if the line contains a FROM instruction with the specified imageToFind . If the image does not have the given tag then stringBuilder will get a modified version of the line with the new tag . We return true in this instance . If the inbound line does not qualify for changes or if the tag is already correct the stringBuilder will get line added to it . We return false in this instance .
protected boolean changeIfDockerfileBaseImageLine(String imageToFind, String tag,
                                                      StringBuilder stringBuilder, String line,
                                                      String ignoreImageString) {
        boolean modified = false;
        String outputLine = line;
        if (FromInstruction.isFromInstruction(line)) {
            FromInstruction fromInstruction = new FromInstruction(line);
            if (fromInstruction.hasBaseImage(imageToFind) &&
                    fromInstruction.hasADifferentTag(tag) &&
                    !fromInstruction.ignorePR(ignoreImageString)) {
                fromInstruction = fromInstruction.getFromInstructionWithNewTag(tag);
                modified = true;
            }
            outputLine = fromInstruction.toString();
        }
        stringBuilder.append(outputLine).append("\n");
        return modified;
    }
protected boolean changeIfDockerfileBaseImageLine ( String imageToFind , String tag , StringBuilder stringBuilder , String line , String ignoreImageString ) { boolean modified = false ; String outputLine = line ; if ( FromInstruction . isFromInstruction ( line ) ) { FromInstruction fromInstruction = new FromInstruction ( line ) ; if ( fromInstruction . hasBaseImage ( imageToFind ) && fromInstruction . hasADifferentTag ( tag ) && ! fromInstruction . ignorePR ( ignoreImageString ) ) { fromInstruction = fromInstruction . getFromInstructionWithNewTag ( tag ) ; modified = true ; } outputLine = fromInstruction . toString ( ) ; } stringBuilder . append ( outputLine ) . append ( "\n" ) ; return modified ; }
This method will read a line and see if the line contains a FROM instruction with the specified
 {@code imageToFind}.
This method will read a line and see if the line contains a FROM instruction with the specified { @code imageToFind } .
// Only check/modify lines which contain a FROM instruction