首页 > 其他分享 >学好selenium工具,能实现你想得到的所有事情

学好selenium工具,能实现你想得到的所有事情

时间:2022-12-10 11:55:42浏览次数:51  
标签:container runner image selenium 学好 access entrypoint 想得到 Docker

Override the entrypoint of an image

Introduced in GitLab and GitLab Runner 9.4. Read more about the extended configuration options.

Before explaining the available entrypoint override methods, let’s describe how the runner starts. It uses a Docker image for the containers used in the CI/CD jobs:

  1. The runner starts a Docker container using the defined entrypoint. The default from Dockerfile that may be overridden in the .gitlab-ci.yml file.
  2. The runner attaches itself to a running container.
  3. The runner prepares a script (the combination of before_scriptscript, and after_script).
  4. The runner sends the script to the container’s shell stdin and receives the output.

To override the entrypoint of a Docker image, define an empty entrypoint in the .gitlab-ci.yml file, so the runner does not start a useless shell layer. However, that does not work for all Docker versions.

  • For Docker 17.06 and later, the entrypoint can be set to an empty value.
  • For Docker 17.03 and earlier, the entrypoint can be set to /bin/sh -c/bin/bash -c, or an equivalent shell available in the image.

The syntax of image:entrypoint is similar to Dockerfile’s ENTRYPOINT.

Let’s assume you have a super/sql:experimental image with a SQL database in it. You want to use it as a base image for your job because you want to execute some tests with this database binary. Let’s also assume that this image is configured with /usr/bin/super-sql run as an entrypoint. When the container starts without additional options, it runs the database’s process. The runner expects that the image has no entrypoint or that the entrypoint is prepared to start a shell command.

With the extended Docker configuration options, instead of:

  • Creating your own image based on super/sql:experimental.
  • Setting the ENTRYPOINT to a shell.
  • Using the new image in your CI job.

You can now define an entrypoint in the .gitlab-ci.yml file.

For Docker 17.06 and later:

image:
  name: super/sql:experimental
  entrypoint: [""]

For Docker 17.03 and earlier:

image:
  name: super/sql:experimental
  entrypoint: ["/bin/sh", "-c"]

Define image and services in config.toml

Look for the [runners.docker] section:

[runners.docker]
  image = "ruby:latest"
  services = ["mysql:latest", "postgres:latest"]

The image and services defined this way are added to all jobs run by that runner.

Access an image from a private Container Registry

To access private container registries, the GitLab Runner process can use:

To define which option should be used, the runner process reads the configuration in this order:

  • DOCKER_AUTH_CONFIG CI/CD variable.
  • DOCKER_AUTH_CONFIG environment variable set in the runner’s config.toml file.
  • config.json file in $HOME/.docker directory of the user running the process. If the --user flag is provided to run the child processes as unprivileged user, the home directory of the main runner process user is used.

Requirements and limitations

  • Available for Kubernetes executor in GitLab Runner 13.1 and later.
  • Credentials Store and Credential Helpers require binaries to be added to the GitLab Runner $PATH, and require access to do so. Therefore, these features are not available on shared runners, or any other runner where the user does not have access to the environment where the runner is installed.

Use statically-defined credentials

There are two approaches that you can take to access a private registry. Both require setting the CI/CD variable DOCKER_AUTH_CONFIG with appropriate authentication information.

  1. Per-job: To configure one job to access a private registry, add DOCKER_AUTH_CONFIG as a CI/CD variable.
  2. Per-runner: To configure a runner so all its jobs can access a private registry, add DOCKER_AUTH_CONFIG as an environment variable in the runner’s configuration.

标签:container,runner,image,selenium,学好,access,entrypoint,想得到,Docker
From: https://www.cnblogs.com/sdfasdf/p/16971344.html

相关文章

  • selenium获取验证码截图
    获取验证码截图代码:获取验证码代码:#!/user/bin/envpython3#-*-coding:utf-8-*-importrequestsfromseleniumimportwebdriverfromselenium.webdriver.co......
  • Selenium 自动化中实现双击操作
    在selenium中,以name定位为例,单击元素的代码为:driver.find_element_by_name(“name”).click(),那么,实现双击操作的代码能不能写成:driver.find_element_by_name(“name”).do......
  • Selenium06-链接文本定位
    LINK_TEXT超级链接:标记名称是a的页面元素,点击后跳转到其它网页文本型超级链接:是指a的开始标记与结束标记之间有文本内容的超级链接<ahref='flow.php'>查看购物......
  • Selenium07-类名和标记名定位
    CLASS_NAME定位html语法里class属性class属性规定元素的类名(classname),如需为一个元素规定多个类,用空格分隔类名html里的类一般是用于统一设置控件的样式,对文......
  • Selenium05-NAME定位
    NAME定位name属性指定元素的名称,在当前的HTML文档中可以不唯一<inputtype='text'name='username'size=25><inputtype='password'name='password'size=25>W......
  • Selenium02-WebDriver
    SeleniumWebDriver从selenium模块里导入子模块webdriverfromseleniumimportwebdriver调用webdriver模块里浏览器名称的构造方法,构建一个驱动程序对象实例,通......
  • Selenium03-定位元素
    Web自动化测试核心问题Web应用程序的功能自动化(也称为UI自动化)测试的本质就是使用工具代替人工进行界面操作核心问题:如何识别(也叫做定位)要操作的页面元素识别后......
  • Selenium04-ID定位
    ID定位HTML语法中规定id属性在当前的HTML文档中必须是唯一的<inputtype='text'id='username'size=25><inputtype='password'id='password'size=25>WebDrive......
  • Selenium01-介绍
    什么是功能测试和黑盒测试Functionaltesting(功能测试),也称为behavioraltesting(行为测试)或UI层测试根据产品特性、操作描述和用户方案,测试一个产品的特性和可操作行为......
  • 【爬虫】加代理,cookie,header,selenium去重,scrapy-redis实现分布式爬虫
    目录1.加代理,cookie,header,加入selenium1.1加代理1.2加cookie,修改请求头,随机生成UserAgent1.3集成selenium2.去重规则源码分析(布隆过滤器)3.scrapy-redis实现分布式爬......