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

Enhance CBS scripts to fetch external dependencies #299

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

dennis-behm
Copy link
Member

This is extending the existing common backend scripts dbbBuild.sh and zBuilder.sh to automatically fetch external dependencies from an artifact repository (instead of any concatenation).

High-level capabilities:

  • Read build dependency configuration defined in the Application Descriptor.
  • Load external dependencies based on naming conventions of the CBS from an artifact repository (Nexus, Artifactory)
  • Expand the external dependencies in the build workspace for consumption by the build framework

Copy link
Member

@M-DLB M-DLB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments.

Templates/Common-Backend-Scripts/README.md Outdated Show resolved Hide resolved
Templates/Common-Backend-Scripts/README.md Outdated Show resolved Hide resolved
Templates/Common-Backend-Scripts/dbbBuild.sh Outdated Show resolved Hide resolved
#####################################################################################################
## DBB-BUILD.sh parameters ##########################################################################
#####################################################################################################

# Path to main build script build.groovy.
zAppBuild="$HOME/dbb-zappbuild"
# DBEHM: MyCustomization for Path to build.groovy.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to remove this line and the next one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be just for testing for the moment


# (Optional) Additional property files to customize the build framework
zAppBuildPropFiles=""
zAppBuildPropFiles="/var/dbb/dbb-zappbuild-config/build.properties,/var/dbb/dbb-zappbuild-config/datasets.properties,/var/dbb/dbb-zappbuild-config/buildFolder.properties"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to remove this line?

importFolder.mkdirs()

// setup package cache
cacheFolder = new File("/tmp/.pkg")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we externalize this cache folder location with a property in the pipelineBackend.config?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the pipelineBackend.config with new settings and implemented the logic for the fetch

cacheFolder = new File("/tmp/.pkg")
if (!cacheFolder.exists()) cacheFolder.mkdirs()

def yamlSlurper = new groovy.yaml.YamlSlurper()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a Utility class for the Application Descriptor in the DBB repo: https://github.com/IBM/dbb/blob/main/Pipeline/PackageBuildOutputs/utilities/applicationDescriptorUtils.groovy
I guess it would be better to use it.


println("** Downloading application package '$artifactUrl' from Artifact Repository into ${cacheFolder}/${artifactRelPath}.")
def rc = artifactRepositoryHelpers.download(artifactUrl, tarFile as String, user, password, true)
println "download complete $rc" // TODO: Error handling in helper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a better info message, and a handling of rc != 0?

}
}

// Do we actually need this or can this just be obtained from the dependencies?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Baseline section of the AD file is meant to describe "dependency" on itself for a given application. It can serve two purposes: the first one is downloading the packages from earlier version that can be used as a base for artifacts that are not rebuilt (i.e., private object decks, generated include files from BMS, ...). The second one is to detect the baselineReference tag during an impact build.

I think the next section is necessary. Maybe it can be optimized to be turned into a method, to minimize the common code with the previous section.

yamlBuilder externalDependencies

externalDependencyFile = new File(props.externalDependenciesFilePath)
externalDependencyFile.withWriter("IBM-1047") { extDepWriter ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sake of clarity, tagging is missing, even if it might not be useful.

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

Successfully merging this pull request may close these issues.

2 participants