-
Notifications
You must be signed in to change notification settings - Fork 13
111 lines (99 loc) · 3.13 KB
/
eerelease.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Release Ansible Execution Environment
on:
workflow_dispatch:
inputs:
ee-name:
description: 'EE name'
required: true
type: choice
options:
- community-ee-base
- community-ee-minimal
ansible-core-version:
description: >-
Ansible-core version. Example: 2.17.0
required: true
ee-version:
description: >-
EE Release Version, to be appended to the ansible-core version. Example: 1
required: true
tag_as_latest:
description: >-
Whether to tag the image as latest.
type: boolean
required: false
default: false
env:
EE_VERSION: ${{ inputs.ansible-core-version }}-${{ inputs.ee-version }}
IMAGE_NAME: ${{ github.repository_owner }}/${{ inputs.ee-name }}
jobs:
build:
name: Build Execution Environment ${{ inputs.ansible-core-version }}-${{ inputs.ee-version }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
packages: write
steps:
- name: Check out images
uses: actions/checkout@v4
with:
repository: ansible-community/images
ref: main
path: image
- name: Check out eercheck repo for testing
uses: actions/checkout@v4
with:
repository: anweshadas/eercheck
ref: main
path: eercheck
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python3 -m pip install ansible-builder
python3 -m pip install setuptools
sudo apt install podman --yes
pwd
ls -l
- name: Pull the latest fedora image
run: |
podman pull quay.io/fedora/fedora:latest
- name: Build Community EE image
working-directory: image/execution-environments/${{ inputs.ee-name }}
run: |
ansible-builder build --tag "ghcr.io/${IMAGE_NAME}:${EE_VERSION}"
- name: Find the id of the latest EE image
run: |
echo "IMAGE_ID=$(podman images -q "${IMAGE_NAME}:${EE_VERSION}")">>$GITHUB_ENV
- name: Test the image with eercheck
working-directory: eercheck
run: |
pwd
ls -l
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
sudo systemctl start podman.socket
./containertest.py "${IMAGE_ID}"
- name: Create the latest tag
if: ${{ inputs.tag_as_latest }}
run: |
podman tag "${IMAGE_ID}" "ghcr.io/${IMAGE_NAME}:latest"
podman images
- name: Upload artifact EE to ghcr
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ inputs.ee-name }}
tags: >-
${{ env.EE_VERSION }}
${{
inputs.tag_as_latest
&& 'latest'
|| ''
}}
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}