how spcify broser version in zalenium 's docker-compose.yml - zalenium

Is there some way to name the broser version to use in my test ?
for example , i'd like to use chrom 78 in zalenium test.
I've check the question. Some body said : it control by elgalu/selenium. but there is no way to specify the selenium version in docker run or docker-compose.yml

You need to specify the desired elgalu/selenium image through the --seleniumImageName parameter. To find out which elgalu/selenium image you need for Chrome 78, you can head to https://github.com/elgalu/docker-selenium/releases, and check which tag has the version of Chrome you need, when you find it, use that docker image in Zalenium through the parameter mentioned above.

Related

How to build an image from Dockerfile using Earthly target?

I would like to build and image from Dockerfile using Earthly.
You might be wondering why do I want that, because I can describe images right inside of Earthfile, but I have 2 reasons for using external Dockerfile:
ADD command (which I need to download file by URL) is not supported by Earthly yet
I would like to use a heredoc syntax for embedding file's content into container right from Dockerfile. This requires # syntax=docker/dockerfile:1.4, which is again not available in Earthfile
So, here is what I tried to do.
My approximate Dockerfile looks like:
# syntax=docker/dockerfile:1.4
FROM gcr.io/distroless/java17:nonroot
WORKDIR /opt/app
ADD --chown=nonroot https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.4.7/applicationinsights-agent-3.4.7.jar agent.jar
COPY <<EOF /opt/app/applicationinsights.json
{
"instrumentation": {}
}
EOF
And this is how I try to build it with Earthly:
base-image:
FROM earthly/dind:alpine
WORKDIR /build
ENV DOCKER_BUILDKIT=1 # <---- required to support heredoc syntax
COPY distroless-runtime-17.Dockerfile Dockerfile
WITH DOCKER --allow-privileged
RUN docker build . -t base-17-image
END
While the WITH DOCKER RUN part gets executed successfully, I do not know how to use the result of base-image target in other targets to package my app using the resulting base image. The FROM base-17-image just fails as if it does not exist (and this tag really does not exist - docker run base-17-image fails with the same reason).
It turned out to be very easy and natively supported:
The whole recipe is just 2 lines of code:
base-image:
FROM DOCKERFILE -f distroless-runtime-17.Dockerfile .
and the result can of the above step can be reused to package your application as: FROM +base-image

Docker image retag for build promotion

I am trying to promote a docker image in my Jenkins pipeline using Jenkins docker plugin but I am able to do so as I am getting following error.
"docker tag" requires exactly 2 arguments.
See 'docker tag --help'.
Usage: docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
I can see the following in the logs
docker tag artifactory.mycompany.com/docker-dev/appname/dev:latest artifactory.mycompany.com/docker-dev/appname/dev:artifactory.mycompany.com/docker-dev/appname/dev:latest artifactory.mycompany.com/docker-dev/appname/test:latest
Pipeline code:
testImage = docker.image("artifactory.mycompany.com/docker-dev/appname/dev:latest")
testImage.pull()
testImage.push("artifactory.mycompany.com/docker-dev/appname/dev:latest artifactory.mycompany.com/docker-dev/appname/test:latest" )
Any idea what's wrong here...
Edit#1:
If I do following the I get different error.
testImage = docker.image("artifactory.mycompany.com/docker-dev/appname/dev:latest")
testImage.pull()
testImage.tag("artifactory.mycompany.com/docker-dev/appname/test:latest")
testImage.push( )
Error:
Error parsing reference: "artifactory.mycompany.com/docker-dev/appnamee/dev:artifactory.mycompany.com/docker-dev/appname/test:latest" is not a valid repository/tag: invalid reference format
It seems that you are running into some confusion on what each docker command does and how to add new tags to an existing docker on your workspace.
On Jenkins world, docker commands behave like this
docker.image takes a single argument, composing IMAGE_NAME:TAG
docker.tag with a single argument, will assume TAG (this command will not change 'IMAGE_NAME', it will only change the TAG part)
docker.push takes a single optional argument, TAG, meant to push an already existing Image with a different tag only (not with a different IMAGE_NAME)
On your pipeline, you are trying to change the IMAGE_NAME part of the docker identifier, since, none of the above commands help you.
NEW SOLUTION
Another way of approaching this issue is to make the IMAGE_NAME change via shell, and then use the Jenkins plugins to map and push the images
sh("docker tag ORIGINAL_IMAGE_NAME:ORIGINAL_TAG NEW_IMAGE_NAME:NEW_TAG")
newImage = docker.image("NEW_IMAGE_NAME:NEW_TAG")
# docker plugin should find the image on the localhost, so there is no need to pull it form the registry
newImage.push
on your code, something like
sh ('docker tag artifactory.mycompany.com/docker-dev/appname/dev:latest artifactory.mycompany.com/docker-dev/appname/test:latest')
testImage2 = docker.image('artifactory.mycompany.com/docker-dev/appname/test:latest')
and then, push each image independently from the other
testImage.push()
testImage2.push()
DID NOT WORK
You could try supplying 2 arguments to docker.tag, such as
docker.tag (ORIGINAL_IMAGE_NAME:ORIGINAL_TAG, NEW_IMAGE_NAME:NEW_TAG)
in your case, something like
testImage.tag ("artifactory.mycompany.com/docker-dev/appname/dev:latest" "artifactory.mycompany.com/docker-dev/appname/test:latest")
and then, push each image independently from the other
testImage.push (ORIGINAL_IMAGE_NAME:ORIGINAL_TAG)
testImage.push (NEW_IMAGE_NAME:NEW_TAG)

Remove petstore spec when starting swagger editor

I am using Swagger Editor locally in my machine.
When I start the Swagger Editor, it shows the spec for petstore by default at startup.
I want to remove that and show a blank editor. Is there a way to do that at startup.
A simple workaround is to run the editor with the ?url= parameter where the URL points to an empty page (no HTTP response body), such as http://httpbin.org/status/200.
http://editor.swagger.io/?url=http://httpbin.org/status/200
This will open a blank editor.
Alternatively, you can modify the editor's source code and build your own version. You will need Node.js 6.x and npm 3.x (as of time of this writing).
The default editor contents seems to be set here:
https://github.com/swagger-api/swagger-editor/blob/master/src/plugins/local-storage/index.js#L29
In src\plugins\local-storage\index.js, replace
import PetstoreYaml from "./petstore"
with
const PetstoreYaml = ""
Rebuild the editor:
npm run build
Insert url property into swagger-editor's index.html like swagger-ui's it.
detail
Open custom yaml spec in swagger editor on startup · Issue #1727 · swagger-api/swagger-editor
You can use Swagger-UI's config options to load in your own definiton: there's url for fetching a remote document, and spec for passing in a JavaScript object directly. Swagger-Editor passes these options directly to its underlying Swagger-UI instance.
Use the following js code to remove the default content in swagger editor.
editor = SwaggerEditorBundle({
dom_id: "#swagger-editor",
layout: "StandaloneLayout",
presets: [SwaggerEditorStandalonePreset]
});
window.editor = editor;
// The line to remove the content in swagger editor
editor.specActions.updateSpec(' ');
If you are using docker image (docker pull swaggerapi/swagger-editor) to run locally the swagger editor, then provide your own local json or yaml file as below:
$ ls
teapi-openapi.yaml
$sudo docker run -d -p 9800:8080 -v $(pwd):/tmp -e SWAGGER_FILE=/tmp/teapi-openapi.yaml swaggerapi/swagger-editor
To access:
http://<IP>:9800/
where, ip is machine IP where swagger editor image is running, Replace 9800 with any port on which you want to access
Starting from the next release v1.4.1, the following property will be added to disable the swagger-ui default petstore url:
springdoc.swagger-ui.disable-swagger-default-url=true
Copied from
https://github.com/springdoc/springdoc-openapi/issues/714#issuecomment-640215759
These two properties worked for me:
springdoc.swagger-ui.disable-swagger-default-url=true
springdoc.swagger-ui.url=/v1/api-docs (<-- your API docs URL)

Setting SonarQube's web context path via command line parameter

Is it possible to set SonarQube's web context path using a command line parameter?
Usually you would set property sonar.web.context=/sonarqube (or similar) in sonar.properties file. But I'm using Docker and would like to avoid editing sonar.properties.
With Docker Compose I got the following which is working like a charm for other command line parameters:
services:
sonarqube:
image: sonarqube:5.4
[...]
entrypoint:
- ./bin/run.sh
- -Dsonar.log.level=INFO
- -Dsonar.web.context=/sonarqube
But it seems to ignore -Dsonar.web.context=/sonarqube :( Is there a way to pass SonarQube a different context path?
Additional info: This is corresponding run.sh file.
With SonarQube 5.4 this is bound to fail: sonar.web.context was dropped in SonarQube 5.4 (SONAR-7122, suggested alternative being to use a sub-domain) and re-introduced in 5.5 (SONAR-7494) following community feedback.
They added the context back in 5.5 RC1
https://jira.sonarsource.com/browse/SONAR-7494

Configure ini file for HHVM 3.0 via socket with nginx

I'm able to start the HipHop VM to use a unix socket. I can accomplish this via:
/usr/bin/hhvm --config /etc/hhvm/server.ini --mode daemon -vPidFile=/var/run/hhvm/pid -vServer.Type=fastcgi -vServer.FileSocket=/var/run/hhvm/hhvm.sock
However, I can't find a reference anywhere with how to set this in the ini file I'm specifying for my config. To use a TCP port the line in server.ini is:
hhvm.server.port = 9000
I've tried both
hhvm.server.filesocket=/var/run/hhvm/hhvm.sock
hhvm.server.socket=/var/run/hhvm/hhvm.sock
Both fail. Anyone know the file setting or where a reference for these settings can be found?
Although I can't find any documentation--they haven't yet written the updated version for the ini file format (as of 2014-05-01): https://github.com/hhvm/hack-hhvm-docs/issues/156
Regardless I figured it out and they confirmed it should be:
hhvm.server.file_socket=/var/run/hhvm/hhvm.sock
It looks like you take the camel case command line argument -vServer.FileSocket and drop the v, lowercase it, split it with underscores instead of camel case.
If y ou follow the above rewrite rules you can convert the old format to the new.

Resources