Skip to content

Commit

Permalink
fix: Applied mainline fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Dec 26, 2024
1 parent 4926aeb commit 0f61c6e
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 27 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
1.1.2
27 changes: 18 additions & 9 deletions cmd/nginx/supply/supply.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions example/buildpack.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
nginx:
version: mainline
newrelic-infra:
version: 1.59.0
newrelic-nginx:
version: 3.4.6

2 changes: 2 additions & 0 deletions example/buildpack.yml.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nginx:
version: mainline
7 changes: 7 additions & 0 deletions example/buildpack.yml.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nginx:
version: mainline
newrelic-infra:
version: 1.59.0
newrelic-nginx:
version: 3.5.0

23 changes: 12 additions & 11 deletions example/manifest.yml
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions example/manifest.yml.default
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions test/test-s4-service-tile.sh
Original file line number Diff line number Diff line change
@@ -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


3 changes: 2 additions & 1 deletion tile-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions tile.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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}"
Expand All @@ -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() {
Expand Down Expand Up @@ -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}"
Expand Down

0 comments on commit 0f61c6e

Please sign in to comment.