Skip to content

Commit

Permalink
r0.3.4 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylertitsworth authored Feb 23, 2024
2 parents 3c766c5 + 8a737a8 commit 70e752f
Show file tree
Hide file tree
Showing 143 changed files with 9,418 additions and 8,485 deletions.
42 changes: 29 additions & 13 deletions .github/action.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,72 @@
---
name: Build Container Group Action
description: 'https://github.com/intel/ai-containers/blob/main/.github/container_pipeline_format'
description: https://github.com/intel/ai-containers/blob/main/.github/container_pipeline_format
author: [email protected]
inputs:
group_dir:
description: 'Directory with docker-compose.yaml to build'
description: Directory with docker-compose.yaml to build
required: true
type: string
env_overrides:
description: 'Bash Env Variable Overrides in `KEY=VAL && KEY2=VAL2` format'
description: Bash Env Variable Overrides in `KEY=VAL && KEY2=VAL2` format
required: false
type: string
registry:
description: 'Container Registry URL'
required: true
description: Container Registry URL
required: false
default: 'intel'
type: string
repo:
description: Container Project Repository
required: false
default: 'ai-containers'
type: string
no-push:
description: Do not push to Registry
required: false
default: false
type: boolean
runs:
using: composite
steps:
- name: Random Number Generator
shell: bash
run: echo "random-number=$(shuf -i 0-1000 -n1)" >> $GITHUB_ENV
- name: Remove Containers
shell: bash
run: |
REGISTRY=${{ inputs.registry }} \
COMPOSE_PROJECT_NAME=${{ env.random-number }} \
${{ inputs.env_overrides }} docker compose -p ${{ env.random-number }} down --rmi all
- name: Build Containers
shell: bash
run: |
REGISTRY=${{ inputs.registry }} \
REPO=${{ inputs.repo }} \
COMPOSE_PROJECT_NAME=${{ env.random-number }} \
${{ inputs.env_overrides }} docker compose -p ${{ env.random-number }} up --build --force-recreate --always-recreate-deps
${{ inputs.env_overrides }} docker compose -p ${{ env.random-number }} up --build --force-recreate --always-recreate-deps
working-directory: ${{ inputs.group_dir }}
- name: Push Containers
shell: bash
if: ${{ !fromJson(inputs.no-push) }}
run: |
REGISTRY=${{ inputs.registry }} \
REPO=${{ inputs.repo }} \
COMPOSE_PROJECT_NAME=${{ env.random-number }} \
${{ inputs.env_overrides }} docker compose -p ${{ env.random-number }} push --ignore-push-failures
working-directory: ${{ inputs.group_dir }}
- name: Print Containers
shell: bash
run: |
REGISTRY=${{ inputs.registry }} \
REPO=${{ inputs.repo }} \
COMPOSE_PROJECT_NAME=${{ env.random-number }} \
${{ inputs.env_overrides }} docker compose -p ${{ env.random-number }} images --format json | jq '.[] | "\(.Repository):\(.Tag)"' >> $GITHUB_STEP_SUMMARY
working-directory: ${{ inputs.group_dir }}
- name: Remove Containers
- name: Un-Tag Containers
if: ${{ always() }}
shell: bash
run: |
REGISTRY=${{ inputs.registry }} \
REPO=${{ inputs.repo }} \
COMPOSE_PROJECT_NAME=${{ env.random-number }} \
${{ inputs.env_overrides }} docker compose -p ${{ env.random-number }} down --rmi all
working-directory: ${{ inputs.group_dir }}
- name: Remove Containers
if: ${{ always() }}
shell: bash
run: docker system prune --force
157 changes: 0 additions & 157 deletions .github/container_pipeline_format.md

This file was deleted.

11 changes: 11 additions & 0 deletions .github/linters/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
ignored:
- DL3006
- DL3008
- DL3009
- DL3013
- DL3059
- DL4006
- SC1008
- SC2140
- SC2239
5 changes: 5 additions & 0 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ignore": [
"test-runner/test_runner.py"
]
}
7 changes: 7 additions & 0 deletions .github/linters/.markdown-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
MD013: false
MD024: false
MD028: false
MD033: false
MD034: false
MD041: false
2 changes: 2 additions & 0 deletions .github/linters/.python-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[MESSAGES CONTROL]
disable=line-too-long, missing-module-docstring, redefined-outer-name, no-member, used-before-assignment, consider-using-with, bare-except, consider-using-dict-items, import-error, broad-exception-caught, raise-missing-from, not-an-iterable, too-few-public-methods
2 changes: 2 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
ignore: '**/templates/**.yaml'
7 changes: 7 additions & 0 deletions .github/linters/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
self-hosted-runner:
labels:
- builder
- k8-runners
- aia-devops
- test-runner
16 changes: 8 additions & 8 deletions .github/utils/Dockerfile.compose
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,30 @@ RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
python3-distutils \
python3-pip \
python3-venv \
wget
wget

ARG COMPOSE_VERSION=2.19.0
ENV DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
RUN mkdir -p $DOCKER_CONFIG/cli-plugins && \
curl --insecure -SL https://github.com/docker/compose/releases/download/v2.20.0/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose && \
curl --insecure -SL https://github.com/docker/compose/releases/download/v2.24.5/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose && \
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose

RUN ln -sf $(which python3) /usr/local/bin/python && \
ln -sf $(which python3) /usr/local/bin/python3 && \
ln -sf $(which python3) /usr/bin/python
RUN ln -sf "$(which python3)" /usr/local/bin/python && \
ln -sf "$(which python3)" /usr/local/bin/python3 && \
ln -sf "$(which python3)" /usr/bin/python

RUN python -m pip --no-cache-dir install --upgrade \
pip \
setuptools

FROM compose-devel AS node

SHELL ["bin/bash", "-c"]
SHELL ["/bin/bash", "-c"]

ARG NODE_VERSION=16.20.1

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
RUN echo -e 'export NVM_DIR="$HOME/.nvm"\n[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm\n[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"' >> "$HOME/.bashrc"
RUN curl -o - https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
RUN echo -e "export NVM_DIR=$HOME/.nvm\n[ -s $NVM_DIR/nvm.sh ] && . $NVM_DIR/nvm.sh # This loads nvm\n[ -s $NVM_DIR/bash_completion ] && . $NVM_DIR/bash_completion" >> "$HOME/.bashrc"

RUN chmod +x /root/.nvm/nvm.sh && \
/root/.nvm/nvm.sh install $NODE_VERSION && \
Expand Down
24 changes: 15 additions & 9 deletions .github/utils/val-args.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -euf -o pipefail

# Input string
input_string="$1"

Expand All @@ -13,12 +15,16 @@ else
fi

# Use regex to extract key-value pairs with the cases:
# my-dir: my-value
# my_dir: my_value
# my_dir=my-value
# my_dir=my-value
# mydir = myvalue
# etc.
##
regex="([[:alnum:]_-]+)[[:space:]]*[:=][[:space:]]*([[:alnum:]\/=_\-\s']+)"
echo $matched_line | grep -oP $regex | sed 's/: /=/g' >> $GITHUB_OUTPUT
# The regex now ensures that there is at least one 'a-zA-Z' value present
regex="([a-zA-Z]+[a-zA-Z0-9_-]+)\s*[:=]\s*([a-zA-Z0-9\/=_\-\s']+)"
key_val_pairs=$(echo "$matched_line" | grep -oP "$regex" | sed 's/: /=/g')

# Check if there is at least one key-value pair
if [[ -z "$key_val_pairs" ]]; then
echo "Error: The matched line does not contain any valid key-value pairs."
exit 1
fi

# Print the key-value pairs
echo "$key_val_pairs"
echo "$key_val_pairs" >> "$GITHUB_OUTPUT"
10 changes: 6 additions & 4 deletions .github/workflows/bandit.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
---
name: Bandit Scan
on:
pull_request_review:
types: [submitted]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions: read-all

jobs:
scan-bandit:
if: github.event.review.state == 'approved'
uses: intel-innersource/frameworks.ai.infrastructure.code-scan-tools/.github/workflows/Scanner_Bandit.yml@one-ci-cd
with:
org: ${{ github.repository_owner }}
repo: ${{ github.event.repository.name }}
refs: ${{ github.event.pull_request.base.ref }}
runners: "['k8-runners']"
refs: ${{ github.event.pull_request.base.ref }}
runners: '[''k8-runners'']'
secrets:
token: ${{ secrets.ACTION_TOKEN }}
Loading

0 comments on commit 70e752f

Please sign in to comment.