首页 > 其他分享 >Pytest----如何使用logging模块写日志

Pytest----如何使用logging模块写日志

时间:2022-12-08 12:44:07浏览次数:48  
标签:access logging runner image ---- Pytest entrypoint container 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.

标签:access,logging,runner,image,----,Pytest,entrypoint,container,Docker
From: https://www.cnblogs.com/sdfasdf/p/16965774.html

相关文章

  • 用nginx缓存静态文件
      这篇教程说明你应该怎样配置nginx、设置HTTP头部过期时间,用Cache-Control中的max-age标记为静态文件(比如图片、CSS和Javascript文件)设置一个时间,这样用户的......
  • 【推荐】5款超好用的Linux虚拟终端!
    Linux常见的虚拟终端有很多,其中包括:Gnome-terminal、Konsole、XfceTerminal、Terminator、Yakuake等,本文为大家重点介绍几个好用的Linux虚拟终端。1、Gnome-termin......
  • Redis的Multi的内幕真相
    今天遇到个Redis奇慢的问题,断点分析发现跟multi有关。由于本人太忙不想去阅读RedisServer的源代码(其实是懒),就通过TCPDump来分析吧。步骤:1.先在RedisServer上启动TCPDump:......
  • PCB制造常用的13种测试方法,你掌握了几种?
    印刷电路板(PCB)广泛应用于各种电子设备中,无论是手机、电脑还是复杂的机器,你都可找到电路板。如果PCB存在缺陷或制造问题,则可能导致最终产品出现故障并造成不便。在这些情况......
  • Golang依赖管理工具:glide从入门到精通使用
    这是一个创建于 2017-07-2205:33:09 的文章,其中的信息可能已经有所发展或是发生改变。介绍不论是开发Java还是你正在学习的Golang,都会遇到依赖管理问题。Java有牛逼轰轰......
  • Python入门笔记(一)
    文章目录​​第一章初识python​​​​1.1python介绍​​​​1.2Python、pycharm、anaconda安装​​​​1.3print()和input()​​​​1.4保留字和标识符​​​​1.5变......
  • 迅为3A5000_7A2000开发板8G/16G内存Loongnix
    主要参数    处理器:龙芯3A5000主频:2.3GHz-2.5GHz桥片:7A2000内存:8GB、16GBDDR4带ECC纠错(配置可选)系统:Loongnix典型功耗:35W核心板:16层底板:4层核心板......
  • Python入门笔记(三)
    文章目录​​第十二章异常处理​​​​12.1常见异常​​​​12.2处理异常:try--except​​​​12.3创建异常类型:raise语句​​​​12.4断言:assert​​​​12.5存储数......
  • 黑马程序员3天玩转Python深度学习tensorflow(第1天)
    文章目录​​一、深度学习的介绍​​​​1.1深度学习与机器学习的区别​​​​1.1.1特征提取方面​​​​1.1.2数据量和计算性能要求​​​​1.1.3算法代表​​​​1.2......
  • (黑马)C++提高编程笔记
    文章目录​​1模板​​​​1.1模板的概念​​​​1.2函数模板​​​​1.2.1函数模板语法​​​​1.2.2函数模板注意事项​​​​1.2.3函数模板案例​​​​1.2.4普通......