When I try to deploy to a remote Tomcat server using grails prod deploy tomcat I get the error:
Has anybody encountered that?
P.S. On the contrary, the command mvn tomcat7:deploy works.
Problem was resolved by adding def warName = configureWarName() to Tomcat.groovy
...
switch (cmd) {
case 'deploy':
war()
def warName = configureWarName()
println "Deploying application $serverContextPath to Tomcat"
deploy(war: warName, url: url, path: serverContextPath, username: user, password: pass)
break
....
Related
node("DevHub && WinServer2019"){
cleanWs()
stage ("in windows docker") {
withDockerRegistry(credentialsId: "ABC_Technical_User", url: "https://abc-swc-build-toolchains-docker-dev") {
dockerImage = docker.image("abc-swc-build-toolchains-docker-dev/ci-snapshot/mt4/windows_vc100:image-13-77d3d3b")
dockerImage.pull()
String rtDocker = ''
def server = Artifactory.newServer url: 'https://abc/artifactory/', credentialsId: 'ABC_Technical_User'
def buildInfo = Artifactory.newBuildInfo()
// Step 2: Create an Artifactory Docker instance:
def bdDocker = Artifactory.docker server: server
buildInfo localBuildInfo = bdDocker.pull 'abc-swc-build-toolchains-docker-dev/ci-snapshot/mt4/windows_vc100:base-image-13-77d3d3b', 'abc-swc-build-toolchains-docker-dev'
// Step 4: Publish the build-info to Artifactory:
buildInfo.append localBuildInfo
echo "buildInfo : ${buildInfo}"
server.publishBuildInfo buildInfo
}
}
}
I am getting below error
INFO: Pulling image: abc-swc-build-toolchains-docker-dev/ci-snapshot/mt4/windows_vc100:base-image-13-77d3d3b
**java.lang.RuntimeException: Unsupported OS**
at com.github.dockerjava.netty.NettyDockerCmdExecFactory$UnixDomainSocketInitializer.init(NettyDockerCmdExecFactory.java:147)
at com.github.dockerjava.netty.NettyDockerCmdExecFactory.init(NettyDockerCmdExecFactory.java:116)
at com.github.dockerjava.core.DockerClientImpl.withDockerCmdExecFactory(DockerClientImpl.java:193)
at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:45)
at org.jfrog.build.extractor.docker.DockerJavaWrapper.getDockerClient(DockerJavaWrapper.java:77)
at org.jfrog.build.extractor.docker.DockerJavaWrapper.pullImage(DockerJavaWrapper.java:150)
at org.jfrog.build.extractor.docker.extractor.DockerPull.execute(DockerPull.java:76)
at org.jfrog.build.extractor.packageManager.PackageManagerExtractor.executeAndSaveBuildInfo(PackageManagerExtractor.java:33)
at org.jfrog.build.extractor.docker.extractor.DockerPull.main(DockerPull.java:61)
java.lang.RuntimeException: docker build failed
Can someone help me on this?
Would it be possible for you to test the scenario with the latest Jenkins Artifactory plugin and Java 11? I remember a similar issue reported in the past due to a lower Java version/old plugin as well. Upgrading the plugin to the latest version along with the respective Java version mentioned, should help in resolving the issue.
I am currently using 2 config files to run my Protractor scripts using Jenkins.
devConfig.ts and prodConfig.ts
These have the dev creds and URL and the prod creds and URL.
I have two Jenkins jobs that run different commands
npm run tsc && protractor tmp/devConfig.js --suite devRegression
npm run tsc && protractor tmp/devConfig.js --suite prodRegression
Instead of having two config files, how is it possible to do in one? By passing params for URL, Creds, Suite and Browser?
I was able to setup on Jenkins:
and this leads to
But I am not able to pass them back to the protractor scripts. Is there a straightforward way to construct these parameters and pass them on to protractor?
For protractor side check out this page
Per its content, having this in your conf.js:
module.exports = {
params: {
login: {
email: 'default',
password: 'default'
}
},
// * other config options *
}
you can pass any parameter to it in CMD as follows:
protractor --baseUrl='http://some.server.com' conf.js --parameters.login.email=example#gmail.com
--parameters.login.password=foobar
so you end up having this in your specs:
describe('describe some test', function() {
it('describe some step', function() {
browser.get(browser.baseUrl);
$('.email').sendKeys(browser.params.login.email);
$('.password').sendKeys(browser.params.login.password);
});
});
For Jenkins just construct the command as follows:
protractor --baseUrl=${url} conf.js --parameters.login.email=${email}
--parameters.login.password=${password}
Another way if you want to just pass one parameter is have object in your config.js with mapping of all related params like this:
let param_mapping = {
prod: {
url: "https://prod.app.com",
email: "prod#gmail.com",
password: "Test1234"
},
dev: {
url: "https://dev.app.com",
email: "dev#gmail.com",
password: "Test1234"
},
stage: {
url: "https://stage.app.com",
email: "stage#gmail.com",
password: "Test1234"
}
};
let parameters = param_mapping[process.ENV.CUSTOM_ENV];
exports.config = {
baseUrl: parameters.url,
params: parameters,
// ...
};
and then start your process with an environment variable:
CUSTOM_ENV=dev protractor protractor.conf.js
Please note, I haven't tested this particular code now, but I did test the logic a little while ago, so this can be your approach
I have separated dataSourceConfig.yml database config file:
environments:
development:
dataSource:
dbCreate: none
url: jdbc:oracle:thin:xxxxxx
driverClassName: oracle.jdbc.OracleDriver
dialect: org.hibernate.dialect.Oracle10gDialect
username: xxxx
password: xxxx
test:
dataSource:
dbCreate: none
url: jdbc:oracle:thin:xxxxx
driverClassName: oracle.jdbc.OracleDriver
dialect: org.hibernate.dialect.Oracle10gDialect
username: xxxxx
password: xxxxx
Which I connect to the project in the Application.java:
class Application extends GrailsAutoConfiguration implements EnvironmentAware {
static void main(String[] args) {
GrailsApp.run(Application, args)
}
#Override
void setEnvironment(Environment environment) {
String configPath = environment.getProperty("local.config.location")
Resource resourceConfig = new FileSystemResource(configPath)
YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
ypfb.setResources([resourceConfig] as Resource[])
ypfb.afterPropertiesSet()
Properties properties = ypfb.getObject()
environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties))
}
}
When i run integration tests via Intellij IDEA 15, it runs tests at a development environment, but the YAML config file has test section.
Is anyone knows how to fix this?
The command bellow doesn't help.
grails test test-app -integration
If you are going to run tests from the IDE you need to modify the run config to include -Dgrails.env=test. You will want to do that for the default JUnit run config so you don't have to edit every single test run config. Be aware that editing the default JUnit run config will affect all configs that are created in the future but will not update any existing configs. You may want to remove all of the existing run configs so they will be recreated with the new settings the next time you run those tests.
i'v try to deploy the grunt output folder ( dist ) to server space using grunt-deploy in Jenkins. it return success message after grunt deploy.but it actually not deploy to given target.and there is option for username and password of server.so i think its not secure method .if yes give me a correct method for that.also there is no option for source path . this is my deploy code.
deploy: {
liveservers: {
options:{
servers: [{
host: 'host',
port: 'port',
username: 'user',
password: 'pass'
}],
cmds_before_deploy: [],
cmds_after_deploy: [],
deploy_path: '/home/testdeploy'
}
} }
please help me :(
Use the mkdir command to create a releases subfolder:
cd /home/testdeploy
mkdir releases
then retry. The existence of releases is a hardcoded assumption in the source
References
grunt-deploy: deploy.js source
It seems that only grails.serverURL and grails.path are recognized as per environment configrautions. bla and foo are ignored and could not be used in application
Anyone could solves this and provide a way to get bla and foo configured per environment?
environments {
production {
grails.serverURL = "http://alpha.foo.de"
grails.path = ""
bla = "text"
foo= "word"
}
test {
grails.serverURL = "http://test.foo.de"
grails.path = ""
bla = "othertext"
foo= "otherword"
}
}
Since Grails 3.0, both Groovy or YAML syntax can be used. The new main application configuration file is /conf/application.yml but you can continue to use your existing groovy configuration defining a /conf/application.groovy file.
This is an example of datasource definition per environment (in YAML):
environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb
production:
dataSource:
dbCreate: update
url: jdbc:h2:prodDb
myenv:
dataSource:
dbCreate: update
url: jdbc:h2:myenvDb
To run a grails command in a specific environment you can use:
grails [environment] [command name]
To target an environment different from dev, test and prod you can use:
grails -Dgrails.env=myenv run-app
See the grails environment documentation or this example application for more information.
All the ConfigSlurper variables are scoped by environment. What you've shown above should work fine.
When you use grails run-app, you are running in the development environment by default. Could that be your issue?
Try...
> grails prod run-app
This should give you bla (text) and foo (word)
> grails test run-app
This should give you bla (othertext) and foo (otherword)
Config.groovy setting
environments {
development {
grails.serverURL = "http://alpha.foo.de"
grails.path = "/bar"
staticServerURL = "http://static.foo.de"
staticPath = "/static"
}
}
source code index.gsp
${grailsApplication.config.staticServerURL}a
${grailsApplication.config.staticPath}b
${grailsApplication.config.grails.serverURL}c
${grailsApplication.config.grails.path}d
what is printed out when started with grails run-app
a b http://alpha.foo.dec /bard
Check in your Config.groovy that you have the import for Environment
import grails.util.Environment
Otherwise the Environment.current is empty.