forked from openstack-k8s-operators/ci-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds a new containerfile defining the container we will use with the upcoming CLI, maybe in CI jobs soon as well. With every merge into the ci-framework repo the container will be build using the ref content and tagged with the Git SHA. If the PR is merged into the main branch the "latest" tag will be updated. Jira: https://issues.redhat.com/browse/OSPRH-9458
- Loading branch information
1 parent
f57f048
commit fd196fb
Showing
9 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Build and Push Image | ||
on: [ push ] | ||
env: | ||
IMAGE_NAME: cifmw-client | ||
IMAGE_REGISTRY: quay.rdoproject.org/ci-framework | ||
REGISTRY_USER: ${{ secrets.QUAY_RDO_CI_FRAMEWORK_USERNAME }} | ||
REGISTRY_PASSWORD: ${{ secrets.QUAY_RDO_CI_FRAMEWORK_PASSWORD }} | ||
|
||
jobs: | ||
build: | ||
name: Build and push image | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get branch name | ||
id: branch-name | ||
uses: tj-actions/branch-names@v7 | ||
|
||
# Overriding the LATEST_TAG var allows us to track latest | ||
# tags for other branches, "latest" won't move unless code | ||
# is merged into the main branch. | ||
- name: Set latest tag for non main branch | ||
if: "${{ steps.branch-name.outputs.current_branch != 'main' }}" | ||
run: | | ||
echo "LATEST_TAG=${{ steps.branch-name.outputs.current_branch }}-latest" >> $GITHUB_ENV | ||
- name: Build Image | ||
id: build-image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
image: ${{ env.IMAGE_NAME }} | ||
tags: ${{ env.LATEST_TAG }} ${{ github.sha }} | ||
containerfiles: | | ||
containerfiles/Containerfile.client | ||
- name: Push To quay.rdoproject.org | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build-image.outputs.image }} | ||
tags: ${{ steps.build-image.outputs.tags }} | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
username: ${{ env.REGISTRY_USER }} | ||
password: ${{ env.REGISTRY_PASSWORD }} | ||
|
||
- name: Print image url | ||
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Run build_push_container role | ||
hosts: "{{ cifmw_target_host | default('localhost') }}" | ||
tasks: | ||
- name: Run build_push_container role | ||
ansible.builtin.include_role: | ||
name: build_push_container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
- name: Run build_push_container role | ||
hosts: "controller" | ||
tasks: | ||
- name: Run build_push_container role | ||
vars: | ||
ci_framework_src_dir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework" | ||
ansible.builtin.command: | ||
chdir: "{{ ci_framework_src_dir }}" | ||
cmd: >- | ||
~/test-python/bin/ansible-playbook ci/playbooks/build_push_container.yml | ||
-i {{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml | ||
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM quay.io/centos/centos:stream9 | ||
|
||
LABEL summary="CI-Framework client image" \ | ||
maintainer="CI Framework" | ||
|
||
# USER root | ||
RUN dnf update -y && \ | ||
dnf install -y git python3.11 python3.11-pip \ | ||
python3-netaddr make gcc sudo rsync vim && \ | ||
dnf clean all | ||
|
||
RUN adduser cifmw | ||
|
||
RUN echo "cifmw ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/cifmw | ||
|
||
ENV PATH="/home/cifmw/test-python/bin:$PATH:/home/cifmw/.local/bin" | ||
|
||
USER cifmw | ||
|
||
# COPY --chown=cifmw:cifmw . /home/cifmw/ci-framework | ||
|
||
RUN mkdir -p /home/cifmw/ci-framework && git clone https://github.com/openstack-k8s-operators/ci-framework.git /home/cifmw/ci-framework/ | ||
|
||
WORKDIR /home/cifmw/ci-framework | ||
|
||
RUN /usr/bin/make -C /home/cifmw/ci-framework setup_molecule USE_VENV=yes | ||
|
||
# todo(Lewis): Add pre-commit install | ||
# RUN /home/cifmw/test-python/bin/pre-commit install --install-hooks | ||
|
||
# todo(Lewis): Add entrypoint script to source python venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters