add options to enable dockerhub auth
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2020-12-06 13:35:42 +01:00
parent 1b52c493c2
commit faebc9aa12
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61
6 changed files with 55 additions and 6 deletions

View File

@ -50,6 +50,18 @@ droneci_autoscaler_agent_architecture: amd64
droneci_autoscaler_agent_volumes: [] droneci_autoscaler_agent_volumes: []
droneci_autoscaler_agent_package_upgrade: False droneci_autoscaler_agent_package_upgrade: False
# @var droneci_autoscaler_docker_auth_config:description: Docker registries auth config file (config.json).
# @var droneci_autoscaler_docker_auth_config: >
# droneci_autoscaler_docker_auth_config: |
# {
# "auths": {
# "https://index.docker.io/v1/": {
# "auth": "abc...xy="
# }
# }
# }
# @end
droneci_autoscaler_instances: [] droneci_autoscaler_instances: []
# @var droneci_autoscaler_instances:example: > # @var droneci_autoscaler_instances:example: >
# droneci_autoscaler_instances: # droneci_autoscaler_instances:
@ -60,6 +72,14 @@ droneci_autoscaler_instances: []
# agent_architecture: amd64 # agent_architecture: amd64
# sshkey: "dummy" # sshkey: "dummy"
# api_host: "drone-amd64.example.com" # api_host: "drone-amd64.example.com"
# docker_auth_config: |
# {
# "auths": {
# "https://index.docker.io/v1/": {
# "auth": "abc...xy="
# }
# }
# }
# provider_config: # provider_config:
# - name: DRONE_HETZNERCLOUD_DATACENTER # - name: DRONE_HETZNERCLOUD_DATACENTER
# value: fsn1-dc14 # value: fsn1-dc14
@ -78,6 +98,7 @@ droneci_autoscaler_instances: []
droneci_autoscaler_runner_volumes: [] droneci_autoscaler_runner_volumes: []
droneci_autoscaler_runner_privileged: [] droneci_autoscaler_runner_privileged: []
droneci_autoscaler_runner_env_file: /etc/drone.conf
# @var droneci_autoscaler_volumes:description: > # @var droneci_autoscaler_volumes:description: >
# Define required docker volumes. If you don't use sqlite you could remove the default volume. # Define required docker volumes. If you don't use sqlite you could remove the default volume.

View File

@ -11,6 +11,18 @@
dockerengine_networks: dockerengine_networks:
- name: droneci_default - name: droneci_default
droneci_autoscaler_service_stopped: True droneci_autoscaler_service_stopped: True
droneci_autoscaler_docker_auth_config: |
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "abc...xy="
}
}
}
droneci_autoscaler_agent_volumes:
- "/root/.docker/config.json:/root/.docker/config.json"
droneci_autoscaler_agent_environ:
- "DRONE_DOCKER_CONFIG=/root/.docker/config.json"
droneci_autoscaler_instances: droneci_autoscaler_instances:
- name: scaler_amd64 - name: scaler_amd64
pool_max: 50 pool_max: 50

View File

@ -2,8 +2,7 @@
collections: collections:
- name: https://gitea.rknet.org/ansible/xoxys.general/releases/download/v1.2.0/xoxys-general-1.2.0.tar.gz - name: https://gitea.rknet.org/ansible/xoxys.general/releases/download/v1.2.0/xoxys-general-1.2.0.tar.gz
- name: community.general - name: community.general
- name: community.crypto
roles: [] - name: community.crypto
roles: roles:
- src: https://gitea.rknet.org/ansible/xoxys.docker_engine.git - src: https://gitea.rknet.org/ansible/xoxys.docker_engine.git

View File

@ -50,13 +50,15 @@ services:
{% if inst.agent_volumes | default(droneci_autoscaler_agent_volumes) | default(False) %} {% if inst.agent_volumes | default(droneci_autoscaler_agent_volumes) | default(False) %}
- DRONE_AGENT_VOLUMES={{ inst.agent_volumes | default(droneci_autoscaler_agent_volumes) | join(",") }} - DRONE_AGENT_VOLUMES={{ inst.agent_volumes | default(droneci_autoscaler_agent_volumes) | join(",") }}
{% endif %} {% endif %}
{% if inst.agent_environ | default(droneci_autoscaler_agent_environ) | default(False) %}
- DRONE_AGENT_ENVIRON={{ inst.agent_environ | default(droneci_autoscaler_agent_environ) | join(",") }}
{% endif %}
{% if inst.api_host is defined %} {% if inst.api_host is defined %}
- DRONE_HTTP_HOST={{ inst.api_host }} - DRONE_HTTP_HOST={{ inst.api_host }}
{% endif %} {% endif %}
{% if inst.runner_volumes | default(droneci_autoscaler_runner_volumes) | default(False) %} - DRONE_RUNNER_VOLUMES={{ (__droneci_autoscaler_runner_volumes + (inst.runner_volumes | default(droneci_autoscaler_runner_volumes))) | join(",") }}
- DRONE_RUNNER_VOLUMES={{ inst.runner_volumes | default(droneci_autoscaler_runner_volumes) | join(",") }}
{% endif %}
- DRONE_RUNNER_PRIVILEGED_IMAGES={{ inst.runner_privileged | default(droneci_autoscaler_runner_privileged) | join(",") }} - DRONE_RUNNER_PRIVILEGED_IMAGES={{ inst.runner_privileged | default(droneci_autoscaler_runner_privileged) | join(",") }}
- DRONE_RUNNER_ENV_FILE={{ inst.runner_env_file | default(droneci_autoscaler_runner_env_file) }}
- DRONE_GC_ENABLED={{ (inst.gc_enabled | default(droneci_autoscaler_gc_enabled)) | bool | lower }} - DRONE_GC_ENABLED={{ (inst.gc_enabled | default(droneci_autoscaler_gc_enabled)) | bool | lower }}
- DRONE_GC_DEBUG=false - DRONE_GC_DEBUG=false
- DRONE_REAPER_ENABLED=true - DRONE_REAPER_ENABLED=true

View File

@ -8,7 +8,7 @@ package_upgrade: {{ droneci_autoscaler_agent_package_upgrade | bool | lower }}
bootcmd: bootcmd:
- [ dpkg, --add-architecture, armhf ] - [ dpkg, --add-architecture, armhf ]
{% endif %} {%- endif %}
apt: apt:
sources: sources:
@ -47,6 +47,18 @@ write_files:
"tlscert": "/etc/docker/server-cert.pem", "tlscert": "/etc/docker/server-cert.pem",
"tlskey": "/etc/docker/server-key.pem" "tlskey": "/etc/docker/server-key.pem"
} }
{% if inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) is defined %}
- path: /root/.docker/config.json
content: |
{{ inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) | indent(width=6, indentfirst=False) }}
{%- endif %}
- path: /etc/drone.conf
content: |
{% if inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) is defined %}
PLUGIN_CONFIG={{ inst.docker_auth_config | default(droneci_autoscaler_docker_auth_config) | regex_replace("\s+", " ") }}
{%- endif %}
- path: /etc/docker/ca.pem - path: /etc/docker/ca.pem
encoding: b64 encoding: b64

3
vars/main.yml Normal file
View File

@ -0,0 +1,3 @@
---
__droneci_autoscaler_runner_volumes:
- "/etc/drone.conf:/etc/drone.conf"