I am trying to run the following subst
command to replace one string /var/jenkins_home
with another /srv/jenkins-slave-1/data
so that the value in HOST_LOG_DIR
changes from /var/jenkins_home/workspace/ts_myapp_testing_integration-tests
to
/srv/jenkins-slave-1/data/workspace/ts_myapp_testing_integration-tests
but when I run the makefile target substtest
the value of HOST_LOG_FILE
remains unchanged (please see screenshot).
WORKSPACE := "/var/jenkins_home/workspace/ts_myapp_testing_integration-tests"
JENKINS_HOME := "/var/jenkins_home"
JENKINS_HOME_HOST_PATH := "/srv/jenkins-slave-1/data"
HOST_LOG_DIR := $(subst $(JENKINS_HOME),$(JENKINS_HOME_HOST_PATH),$(WORKSPACE))
.PHONY: substtest, print_env
substtest: print_env
print_env:
@echo "WORKSPACE is ${WORKSPACE}"
@echo "JENKINS_HOME is ${JENKINS_HOME}"
@echo "JENKINS_HOME_HOST_PATH is ${JENKINS_HOME_HOST_PATH}"
@echo "HOST_LOG_DIR is ${HOST_LOG_DIR}"][1]][1]
The strange thing is when I replace $(JENKINS_HOME)
with the actual path value /var/jenkins_home
i.e.
HOST_LOG_DIR := $(subst /var/jenkins_home,$(JENKINS_HOME_HOST_PATH),$(WORKSPACE))
then it works as expected,
I need to fix this so that it works without the hard-coded substitution.