Extend packagecloud-push for build-dir

Extend script packagecloud-push.sh with environment variable BUILD_DIR.
Populate BUILD_DIR from JJB config parameter build-dir, required for
cmake anyhow.  This limits the search to a single directory.

Add build-dir default to docker-ci template, "export-packages"

Revise export script to use a constant value for build-dir,
also "export-packages" in $WORKSPACE.

Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
Change-Id: I3da170246fb5868e644756e80c20b07bf68f55f9
diff --git a/jjb/oran-templates/oran-c-cpp-jobs.yaml b/jjb/oran-templates/oran-c-cpp-jobs.yaml
index 386b513..c43e735 100644
--- a/jjb/oran-templates/oran-c-cpp-jobs.yaml
+++ b/jjb/oran-templates/oran-c-cpp-jobs.yaml
@@ -68,7 +68,7 @@
 
     branch: master
     build-days-to-keep: 7
-    build-dir: "$WORKSPACE/target"
+    build-dir: "$WORKSPACE/build"
     build-timeout: 15
     cmake-opts: ""
     cron: "" # avoid for PackageCloud which rejects duplicates
@@ -99,6 +99,7 @@
       - shell: "{pre-build}"
       - shell: !include-raw-escape: ../../global-jjb/shell/cmake-build.sh
       - oran-packagecloud-push:
+          build-dir: "{build-dir}"
           packagecloud-account: "{packagecloud-account}"
           packagecloud-repo: "{packagecloud-repo}"
           debian-distribution-versions: "{debian-distribution-versions}"
diff --git a/jjb/oran-templates/oran-docker-ci-jobs.yaml b/jjb/oran-templates/oran-docker-ci-jobs.yaml
index 601aee1..93c431b 100644
--- a/jjb/oran-templates/oran-docker-ci-jobs.yaml
+++ b/jjb/oran-templates/oran-docker-ci-jobs.yaml
@@ -132,6 +132,7 @@
       - shell: "{post_docker_build_script}"
       - oran-docker-build-export
       - oran-packagecloud-push:
+          build-dir: export-packages # directory with deb/rpm files
           packagecloud-account: "{packagecloud-account}"
           packagecloud-repo: "{packagecloud-repo}"
           debian-distribution-versions: "{debian-distribution-versions}"
diff --git a/jjb/oran-templates/oran-package-cloud-macros.yaml b/jjb/oran-templates/oran-package-cloud-macros.yaml
index 2005d57..cca7720 100644
--- a/jjb/oran-templates/oran-package-cloud-macros.yaml
+++ b/jjb/oran-templates/oran-package-cloud-macros.yaml
@@ -13,9 +13,8 @@
 #   See the License for the specific language governing permissions and
 #   limitations under the License.
 
-# Macros to invoke shell scripts for PackageCloud
-
 - builder:
+    # provisions files required by package_cloud ruby gem
     name: oran-packagecloud-file-provider
     builders:
       - config-file-provider:
@@ -28,6 +27,8 @@
               target: "$HOME/packagecloud_api"
 
 - builder:
+    # Runs shell script to push packages to PackageCloud.
+    # {build-dir} is directory with deb/rpm files to push
     # {packagecloud-account} is PackageCloud account ID; example: oran
     # {packagecloud-repo} is PackageCloud repository; example: master, staging
     # {debian-distribution-versions} is list of DEB package distro/version strings
@@ -38,9 +39,9 @@
     builders:
       - inject:
           properties-content: |
+            BUILD_DIR={build-dir}
             PACKAGECLOUD_ACCOUNT={packagecloud-account}
             PACKAGECLOUD_REPO={packagecloud-repo}
             DEBIAN_DISTRIBUTION_VERSIONS={debian-distribution-versions}
             RPM_DISTRIBUTION_VERSIONS={rpm-distribution-versions}
-      - shell: !include-raw-escape:
-          - ../shell/packagecloud-push.sh
+      - shell: !include-raw-escape: ../shell/packagecloud-push.sh