From 0f61c6ec4919a93ca24a87439fa3f99d3eebebab Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 26 Dec 2024 11:22:02 +0000 Subject: [PATCH] fix: Applied mainline fixes --- VERSION | 2 +- cmd/nginx/supply/supply.go | 27 ++++++++++++++++++--------- example/buildpack.yml | 5 +++++ example/buildpack.yml.default | 2 ++ example/buildpack.yml.version | 7 +++++++ example/manifest.yml | 23 ++++++++++++----------- example/manifest.yml.default | 12 ++++++++++++ test/test-s4-service-tile.sh | 16 ++++++++++++++++ tile-history.yml | 3 ++- tile.yml | 10 +++++----- 10 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 example/buildpack.yml.default create mode 100644 example/buildpack.yml.version create mode 100644 example/manifest.yml.default create mode 100755 test/test-s4-service-tile.sh diff --git a/VERSION b/VERSION index 524cb55..45a1b3f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.1 +1.1.2 diff --git a/cmd/nginx/supply/supply.go b/cmd/nginx/supply/supply.go index 35f7d45..55efa3a 100644 --- a/cmd/nginx/supply/supply.go +++ b/cmd/nginx/supply/supply.go @@ -392,7 +392,7 @@ func (s *Supplier) Setup() error { } } - // Load version lines and default versions from manifest.yml + // Load version lines from manifest.yml var manifest struct { DefaultVersions []struct { Name string `yaml:"name"` @@ -409,19 +409,28 @@ func (s *Supplier) Setup() error { s.DefaultVersions = make(map[string]string) for _, dv := range manifest.DefaultVersions { s.DefaultVersions[dv.Name] = dv.Version - // Debug message for default version values s.Log.Debug(fmt.Sprintf("Loaded default version for %s: %s", dv.Name, dv.Version)) } - // Apply default versions if version lines are missing - if _, ok := s.VersionLinesInfraConfig["mainline"]; !ok { - s.VersionLinesInfraConfig = map[string]string{"mainline": s.DefaultVersions["newrelic-infra"]} - s.Log.Debug(fmt.Sprintf("Default Infra Mainline Version applied: %s", s.VersionLinesInfraConfig["mainline"])) + // Initialize version lines for each product + if infraConfig, ok := manifest.VersionLines["newrelic-infra"]; ok { + s.VersionLinesInfraConfig = infraConfig + s.Log.Debug(fmt.Sprintf("Original Infra Mainline Version: %s", s.VersionLinesInfraConfig["mainline"])) + // Apply default versions for newrelic-infra if not specified + if s.Config.Infra.Version == "" { + s.VersionLinesInfraConfig = map[string]string{"mainline": s.DefaultVersions["newrelic-infra"]} + s.Log.Debug(fmt.Sprintf("Default newrelic-infra version applied: %s", s.VersionLinesInfraConfig["mainline"])) + } } - if _, ok := s.VersionLinesNginxConfig["mainline"]; !ok { - s.VersionLinesNginxConfig = map[string]string{"mainline": s.DefaultVersions["newrelic-nginx"]} - s.Log.Debug(fmt.Sprintf("Default Nginx Mainline Version applied: %s", s.VersionLinesNginxConfig["mainline"])) + if nginxConfig, ok := manifest.VersionLines["newrelic-nginx"]; ok { + s.VersionLinesNginxConfig = nginxConfig + s.Log.Debug(fmt.Sprintf("Original Nginx Mainline Version: %s", s.VersionLinesNginxConfig["mainline"])) + // Apply default versions for newrelic-nginx if not specified + if s.IntConfig.Nginx.Version == "" { + s.VersionLinesNginxConfig = map[string]string{"mainline": s.DefaultVersions["newrelic-nginx"]} + s.Log.Debug(fmt.Sprintf("Default newrelic-nginx version applied: %s", s.VersionLinesNginxConfig["mainline"])) + } } // Debug output to verify correct parsing diff --git a/example/buildpack.yml b/example/buildpack.yml index 38a1cb4..9d87d24 100644 --- a/example/buildpack.yml +++ b/example/buildpack.yml @@ -1,2 +1,7 @@ nginx: version: mainline +newrelic-infra: + version: 1.59.0 +newrelic-nginx: + version: 3.4.6 + diff --git a/example/buildpack.yml.default b/example/buildpack.yml.default new file mode 100644 index 0000000..38a1cb4 --- /dev/null +++ b/example/buildpack.yml.default @@ -0,0 +1,2 @@ +nginx: + version: mainline diff --git a/example/buildpack.yml.version b/example/buildpack.yml.version new file mode 100644 index 0000000..87a02c0 --- /dev/null +++ b/example/buildpack.yml.version @@ -0,0 +1,7 @@ +nginx: + version: mainline +newrelic-infra: + version: 1.59.0 +newrelic-nginx: + version: 3.5.0 + diff --git a/example/manifest.yml b/example/manifest.yml index 2699554..3c0691e 100644 --- a/example/manifest.yml +++ b/example/manifest.yml @@ -1,12 +1,13 @@ applications: - - name: my-app - memory: 1G - disk_quota: 512M - buildpacks: - - nginx_buildpack - - newrelic_nginx_buildpack - env: - STATUS_PORT: 8080 - NRIA_LOG_LEVEL: info - NRIA_LOG_STDOUT: true - stack: cflinuxfs4 +- name: my-app + memory: 1G + disk_quota: 512M + buildpacks: + - nginx_buildpack + - Gulab-BuildPack-NR + env: + STATUS_PORT: 8080 + NRIA_LOG_LEVEL: info + NRIA_LOG_STDOUT: true + services: + - nr-newrelic-broker diff --git a/example/manifest.yml.default b/example/manifest.yml.default new file mode 100644 index 0000000..2699554 --- /dev/null +++ b/example/manifest.yml.default @@ -0,0 +1,12 @@ +applications: + - name: my-app + memory: 1G + disk_quota: 512M + buildpacks: + - nginx_buildpack + - newrelic_nginx_buildpack + env: + STATUS_PORT: 8080 + NRIA_LOG_LEVEL: info + NRIA_LOG_STDOUT: true + stack: cflinuxfs4 diff --git a/test/test-s4-service-tile.sh b/test/test-s4-service-tile.sh new file mode 100755 index 0000000..834ecb9 --- /dev/null +++ b/test/test-s4-service-tile.sh @@ -0,0 +1,16 @@ +#!/bin/bash +cd ../example +ls +cf create-org nr-org +cf target -o "nr-org" +cf create-space nr-space01 +cf target -o "nr-org" -s "nr-space01" +cf buildpacks +cf create-service newrelic nrlabs-plan nr-newrelic-broker +cf bind-service my-app nr-newrelic-broker +cf push +cf logs my-app --recent +cf ssh my-app +cd ../test + + diff --git a/tile-history.yml b/tile-history.yml index 4584d03..1507e4a 100644 --- a/tile-history.yml +++ b/tile-history.yml @@ -6,4 +6,5 @@ history: - 1.0.1 - 1.0.2 - 1.1.0 -version: 1.1.1 +- 1.1.1 +version: 1.1.2 diff --git a/tile.yml b/tile.yml index 9544bd2..42a9705 100644 --- a/tile.yml +++ b/tile.yml @@ -1,5 +1,5 @@ name: newrelic-pcf-nginx-buildpack -version: 1.1.1 +version: 1.1.2 metadata_version: 2.0 label: New Relic Nginx Buildpack for Tanzu description: New Relic Nginx Integration Buildpack for VMware Tanzu @@ -37,7 +37,7 @@ packages: buildpack_order: 32 type: buildpack label: New Relic Nginx Extension Buildpack for cflinuxfs4 - path: './build/newrelic_nginx_buildpack-cached-cflinuxfs4-v1.1.1.zip' + path: './build/newrelic_nginx_buildpack-cached-cflinuxfs4-v1.1.2.zip' pre_deploy: | function delete_nr_anystack_buildpacks() { @@ -114,7 +114,7 @@ packages: then BUILDPACK_ORDER=<%= Shellwords.escape properties.newrelic_nginx_buildpack_cflinuxfs4.buildpack_order %> PKG_NAME=<%= Shellwords.escape properties.newrelic_nginx_buildpack_cflinuxfs4.name %> - BUILDPACK_FILE=${PACKAGE_PATH}/${PKG_NAME}/newrelic_nginx_buildpack-cached-cflinuxfs4-v1.1.1.zip + BUILDPACK_FILE=${PACKAGE_PATH}/${PKG_NAME}/newrelic_nginx_buildpack-cached-cflinuxfs4-v1.1.2.zip #---- echo "PKG_NAME: ${PKG_NAME}" @@ -141,7 +141,7 @@ packages: buildpack_order: 31 type: buildpack label: New Relic Nginx Extension Buildpack for cflinuxfs3 - path: './build/newrelic_nginx_buildpack-cached-cflinuxfs3-v1.1.1.zip' + path: './build/newrelic_nginx_buildpack-cached-cflinuxfs3-v1.1.2.zip' pre_deploy: | function delete_nr_anystack_buildpacks() { @@ -218,7 +218,7 @@ packages: then BUILDPACK_ORDER=<%= Shellwords.escape properties.newrelic_nginx_buildpack_cflinuxfs3.buildpack_order %> PKG_NAME=<%= Shellwords.escape properties.newrelic_nginx_buildpack_cflinuxfs3.name %> - BUILDPACK_FILE=${PACKAGE_PATH}/${PKG_NAME}/newrelic_nginx_buildpack-cached-cflinuxfs3-v1.1.1.zip + BUILDPACK_FILE=${PACKAGE_PATH}/${PKG_NAME}/newrelic_nginx_buildpack-cached-cflinuxfs3-v1.1.2.zip #---- echo "PKG_NAME: ${PKG_NAME}"