diff --git a/scripts/local-tile-build.sh b/scripts/local-tile-build.sh new file mode 100755 index 00000000..00945880 --- /dev/null +++ b/scripts/local-tile-build.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +cd .. +set -e +echo "Local tile build script" + +# Read current version from tile-history.yml +CURRENT_VERSION=$(grep '^version:' tile/tile-history.yml) + +if [ -z "$CURRENT_VERSION" ]; then + echo "Could not read version from tile/tile-history.yml" + exit 1 +fi + +echo "Building version: $CURRENT_VERSION" + +echo "Building Go binary..." +env GOOS=linux GOARCH=amd64 go build -o splunk-firehose-nozzle -ldflags "-X main.version=$CURRENT_VERSION" ./main.go + +# Make sure binary is executable +chmod +x splunk-firehose-nozzle + +# Check if tile command exists +if ! command -v tile &> /dev/null; then + echo "tile command not found. Installing tile-generator..." + pip3 install tile-generator +fi + +# Check if bosh command exists (required by tile-generator) +if ! command -v bosh &> /dev/null; then + echo "bosh command not found. Please install bosh-cli:" + echo " brew install cloudfoundry/tap/bosh-cli" + echo " # or download from: https://github.com/cloudfoundry/bosh-cli/releases" + exit 1 +fi + +# Build the tile +echo "Building tile..." +cd tile +tile build $CURRENT_VERSION +cd .. + +echo "Build completed!" +ls -la tile/product/*.pivotal \ No newline at end of file diff --git a/splunknozzle/nozzle.go b/splunknozzle/nozzle.go index 639f02bd..5bd0a234 100644 --- a/splunknozzle/nozzle.go +++ b/splunknozzle/nozzle.go @@ -3,11 +3,12 @@ package splunknozzle import ( "context" "fmt" - "github.com/cloudfoundry/go-cfclient/v3/resource" "os" "strings" "time" + "github.com/cloudfoundry/go-cfclient/v3/resource" + "code.cloudfoundry.org/lager/v3" "github.com/cloudfoundry-community/splunk-firehose-nozzle/cache" "github.com/cloudfoundry-community/splunk-firehose-nozzle/eventrouter" @@ -88,11 +89,16 @@ func (s *SplunkFirehoseNozzle) EventRouter(cache cache.Cache, eventSink eventsin // CFClient creates a client object which can talk to Cloud Foundry func (s *SplunkFirehoseNozzle) PCFClient() (*NozzleCfClient, error) { - var skipSSL config.Option + var cfConfig *config.Config + var err error + if s.config.SkipSSLCF { - skipSSL = config.SkipTLSValidation() + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.SkipTLSValidation(), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) + } else { + cfConfig, err = config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))) } - if cfConfig, err := config.New(s.config.ApiEndpoint, config.ClientCredentials(s.config.ClientID, s.config.ClientSecret), skipSSL, config.UserAgent(fmt.Sprintf("splunk-firehose-nozzle/%s", s.config.Version))); err != nil { + + if err != nil { return nil, err } else { if cfClient, err := client.New(cfConfig); err != nil {