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

Adds code to build and upload Community Execution Environment via Github Action #76

Merged
merged 36 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
63d136f
Adds Excution Environment Release file
anweshadas Apr 9, 2024
7cf4f6f
Adds initial code for ee-base release
anweshadas May 6, 2024
662a808
Adds code to install dependencies and build image
anweshadas May 8, 2024
8a42acd
Adds code to build, login and upload Base EE image
anweshadas May 8, 2024
0e21d7a
Edits indentation
anweshadas May 8, 2024
db09965
Gives sudo persmission required for apt
anweshadas May 8, 2024
7892c20
Checks the working directory
anweshadas May 8, 2024
86aeed6
Editing the indention to debug
anweshadas May 8, 2024
57f2b0a
Editing the indention to debug
anweshadas May 8, 2024
674f247
Editing the indention to debug
anweshadas May 8, 2024
c715ee0
Checks out to images repo
anweshadas May 8, 2024
10d0b11
Updates to anweshadas personal repo for test
anweshadas May 9, 2024
8146b4a
Updates to anweshadas personal repo for test
anweshadas May 9, 2024
767c5a2
Updates code to debug
anweshadas May 9, 2024
1ce3e92
Updates code to debug
anweshadas May 9, 2024
ac624df
Updates code to debug
anweshadas May 9, 2024
f74eedc
Updates code to debug
anweshadas May 9, 2024
6711f4f
Updates the working directory edits the run command
anweshadas May 9, 2024
4e8978f
Updates the working directories
anweshadas May 9, 2024
13253cf
Updates the working directory
anweshadas May 9, 2024
bd01d4d
Removes ansible-build-data checkout
anweshadas May 9, 2024
ec301f8
Adds publish job
anweshadas May 10, 2024
75a87c1
Updates to debug
anweshadas May 10, 2024
c298326
Updates to debug
anweshadas May 10, 2024
080db6a
Updates to debug
anweshadas May 10, 2024
5fa4fbb
Updates to allow building different images
anweshadas May 11, 2024
083aa55
Updates to allow building different images
anweshadas May 11, 2024
0c4de1c
Updates to clean up
anweshadas May 11, 2024
484b9fc
Updates accordance to feedback
anweshadas May 14, 2024
a992da3
Updates as per feedback
anweshadas May 14, 2024
2c42b61
Updates as per the feedback
anweshadas Jun 3, 2024
9a8d59e
Removes steps for status code checking
anweshadas Jun 4, 2024
9f690d7
Removes status code checking step for test code
anweshadas Jun 4, 2024
90c389a
Update .github/workflows/eerelease.yml
anweshadas Jun 4, 2024
d8a3d7c
Update .github/workflows/eerelease.yml
anweshadas Jun 4, 2024
f65f971
Update .github/workflows/eerelease.yml
anweshadas Jun 4, 2024
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
120 changes: 120 additions & 0 deletions .github/workflows/eerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
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 }}

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/ansible-community/${{ inputs.ee-name }}:${EE_VERSION}"

- name: Find the id of the latest EE image
run: |
echo "IMAGE_ID=$(podman images -q ${{ inputs.ee-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/ansible-community/${{ inputs.ee-name }}:latest
podman images

- name: Login to the Github Container registry
env:
REGISTRY_USER: ${{ github.actor }}
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io/${{ github.repository_owner }}
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Upload artifact EE to ghcr
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ inputs.ee-name }}
tags: ${{ env.EE_VERSION }}
registry: ghcr.io/ansible-community

- name: Check and upload the image latest tag
if: ${{ inputs.tag_as_latest}}
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ inputs.ee-name }}
tags: latest
registry: ghcr.io/${{ github.repository_owner }}