mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-07-02 23:23:21 +00:00
* fix: ansible-builder command error * fix: update paths for ansible-builder execution context and Dockerfile --------- Co-authored-by: wangruidong <940853815@qq.com> Co-authored-by: wrd <w940853815@gmail.com>
74 lines
2.1 KiB
YAML
74 lines
2.1 KiB
YAML
name: Build and Push Ansible Executor Image
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- 'dev'
|
|
- 'dev_osm'
|
|
- 'v*'
|
|
paths:
|
|
- utils/ansible_executor/**
|
|
- apps/libs/ansible/**
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
workflow_dispatch:
|
|
inputs:
|
|
branch:
|
|
description: '构建 Ansible Executor 镜像所用的分支'
|
|
required: true
|
|
type: string
|
|
default: 'main'
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Lock Pull Request
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-d '{"state":"pending", "description":"Action running, merge disabled", "context":"Lock PR"}' \
|
|
"https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.branch || github.ref }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract date
|
|
id: vars
|
|
run: echo "IMAGE_TAG=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_ENV
|
|
|
|
- name: Install ansible-builder
|
|
run: pip install 'ansible-builder>=3.1.1'
|
|
|
|
- name: Create Executor build context
|
|
run: |
|
|
ansible-builder create \
|
|
-f utils/ansible_executor/execution-environment.yml \
|
|
-c utils/ansible_executor/context
|
|
|
|
- name: Build and push multi-arch image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
context: utils/ansible_executor/context
|
|
file: utils/ansible_executor/context/Containerfile
|
|
tags: jumpserver/ansible-executor:${{ env.IMAGE_TAG }}
|