-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added release workflow to auto-generate container (#33)
- Loading branch information
1 parent
a43c0fc
commit 8f4d936
Showing
6 changed files
with
126 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
name: Release | ||
on: | ||
release: | ||
types: | ||
- created | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Image Tag' | ||
required: true | ||
type: string | ||
default: 'latest' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }}/mdd | ||
|
||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GHCR_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
- name: Build and push Docker image | ||
if: ${{ ! inputs.tag }} | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Build and push Docker image | ||
if: ${{ inputs.tag }} | ||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ inputs.tag }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,30 @@ | ||
FROM --platform=linux/amd64 ubuntu:22.04 | ||
|
||
ARG build_date=unspecified | ||
|
||
# workspace location | ||
ARG WORKSPACE | ||
ENV WORKSPACE ${WORKSPACE:-/ansible} | ||
ENV ANSIBLE_COLLECTIONS_PATH / | ||
|
||
COPY requirements.txt /tmp/requirements.txt | ||
COPY requirements.yml /tmp/requirements.yml | ||
COPY . /tmp/ansible-mdd | ||
|
||
USER root | ||
RUN mkdir /root/.ssh && bash -c 'echo -e "Host *\n KexAlgorithms +diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1" > /root/.ssh/config' | ||
RUN mkdir /ansible_collections && chmod 777 /ansible_collections | ||
RUN apt-get update && \ | ||
apt-get install -y python3.10 python3-pip sshpass git && \ | ||
pip3 install --upgrade --no-cache-dir setuptools pip && \ | ||
echo "===> Installing PIP Requirements <===" && \ | ||
pip3 install --no-cache -r /tmp/requirements.txt && \ | ||
echo "===> Installing Ansible Collections <===" && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
ansible-galaxy collection install -r /tmp/requirements.yml | ||
|
||
ENV ANSIBLE_HOST_KEY_CHECKING=false \ | ||
ANSIBLE_RETRY_FILES_ENABLED=false \ | ||
ANSIBLE_SSH_PIPELINING=true | ||
|
||
WORKDIR ${WORKSPACE} |
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
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,16 @@ | ||
ansible==8.4.0 | ||
virl2_client==2.6.0 | ||
netaddr | ||
pynetbox | ||
jsonschema | ||
ipaddress | ||
paramiko | ||
genie | ||
pyats | ||
jmespath | ||
passlib | ||
botocore | ||
boto3 | ||
nso-oc==2.79.4 | ||
networkx | ||
scipy |
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,9 @@ | ||
collections: | ||
- name: https://github.com/ciscodevnet/ansible-cml.git | ||
type: git | ||
- source: /tmp/ansible-mdd | ||
type: dir | ||
- name: https://github.com/model-driven-devops/ansible-nso.git | ||
type: git | ||
- name: amazon.aws | ||
source: https://galaxy.ansible.com |