Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom openldap-minion image #3

Merged
merged 1 commit into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .github/workflows/openldap-minion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: "OpenLDAP Minion 🐳 Container"

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- '*'
paths:
- containers.yml
- '.github/workflows/*.yml'
- 'custom/openldap-minion/*.Dockerfile'

env:
MIRROR_IMAGE_PATH: custom/openldap-minion

jobs:
matrix-generator:
name: "Mirror Matrix Generator"
runs-on: ubuntu-latest
outputs:
dockerinfo: ${{ steps.set-matrix.outputs.dockerinfo }}
steps:
- name: "Fetching Repository Contents"
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Install Requirements
run: |
python -m pip install -r requirements.txt

- name: "Generate Matrix Data"
id: set-matrix
run: |
inv containers.matrix --from-workflow ${{ env.MIRROR_IMAGE_PATH }}

mirror-image:
runs-on: ubuntu-latest
needs: matrix-generator
name: "${{ matrix.dockerinfo.name }}"
strategy:
fail-fast: false
max-parallel: 20
matrix:
dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }}

permissions:
actions: read
checks: write
issues: read
packages: write
pull-requests: read
repository-projects: read
statuses: read

steps:
- name: "Fetching Repository Contents"
uses: actions/checkout@v2

- name: "Throttle concurrent pushes"
run: |
t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t

- name: "Setup DockerFile"
run: |
echo " " >> ./${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}}
echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}}
cat ./${{matrix.dockerinfo.file}}

- name: "Docker QEMU"
uses: docker/setup-qemu-action@v2

- name: "Docker BuildX"
id: buildx
uses: docker/setup-buildx-action@v2

- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

- name: "Log into GitHub Container Registry"
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Build & Publish"
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerinfo.file }}
context: ${{ env.MIRROR_IMAGE_PATH }}
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ will be commited.
## Custom


### [![OpenLDAP Minion](https://github.com/saltstack/salt-ci-containers/actions/workflows/openldap-minion.yml/badge.svg)](https://github.com/saltstack/salt-ci-containers/actions/workflows/openldap-minion.yml)

- openldap-minion:latest - `ghcr.io/saltstack/salt-ci-containers/openldap-minion:latest`


### [![Virt Minion](https://github.com/saltstack/salt-ci-containers/actions/workflows/virt-minion.yml/badge.svg)](https://github.com/saltstack/salt-ci-containers/actions/workflows/virt-minion.yml)

- virt-minion:latest - `ghcr.io/saltstack/salt-ci-containers/virt-minion:latest`
Expand Down
4 changes: 4 additions & 0 deletions containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ salt:
# ----- Custom Containers -------------------------------------------------------------------------------->
# Custom images used in the CI pipeline
custom:
OpenLDAP Minion:
name: openldap-minion
versions:
- latest
Virt Minion:
name: virt-minion
versions:
Expand Down
23 changes: 23 additions & 0 deletions custom/openldap-minion/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
SALT_PATH ?= $(shell python -c 'import os, salt; print(os.path.abspath(salt.__file__ + "../../.."))')

all: build

build:
docker build -t openldap-minion:latest -f latest.Dockerfile .

run:
if [ -d $(SALT_PATH) ]; then \
docker run \
--rm \
--privileged \
--device /dev/mem \
--network host \
--name openldap-minion \
-it \
--mount type=bind,source=$(SALT_PATH),target=/salt \
openldap-minion:latest \
sh; \
fi

clean:
docker rmi openldap-minion
3 changes: 3 additions & 0 deletions custom/openldap-minion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# [![OpenLDAP Minion](https://github.com/saltstack/salt-ci-containers/actions/workflows/openldap-minion.yml/badge.svg)](https://github.com/saltstack/salt-ci-containers/actions/workflows/openldap-minion.yml)

- openldap-minion:latest - `ghcr.io/saltstack/salt-ci-containers/openldap-minion:latest`
12 changes: 12 additions & 0 deletions custom/openldap-minion/latest.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM docker.io/bitnami/openldap:latest

USER root
RUN install_packages \
python3-distro \
python3-jinja2 \
python3-ldap \
python3-msgpack \
python3-pycryptodome \
python3-yaml \
python3-zmq
USER 1001