-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add github actions job for helm publishing to CI workflow (#939)
this job will replace our legacy jenkins job, and be dependent on the new github action job for the network operator docker image.
- Loading branch information
Showing
2 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
.github/workflows/network-operator-docker-and-helm-ci.yaml
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,82 @@ | ||
name: Network Operator Docker and Helm CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- "master" | ||
- "v[0-9]+.[0-9]+.x" | ||
|
||
env: | ||
REGISTRY: nvcr.io/nvstaging/mellanox # for docker | ||
IMAGE_NAME: network-operator | ||
VALID_TAG_REGEX: 'v[0-9]+\.[0-9]+\.[0-9]+(-(beta|rc)\.[0-9]+)?' | ||
NGC_REPO: nvstaging/mellanox/network-operator # for helm | ||
|
||
jobs: | ||
docker-build-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
- name: Determine docker tags | ||
run: | | ||
git_sha=$(git rev-parse --short HEAD) # short git commit hash | ||
git_tag=$(git describe --tags --exact-match 2>/dev/null | grep -E '${{ env.VALID_TAG_REGEX}}' || true) # git tag, if it exists | ||
latest=$(git branch --show-current | grep -q 'master' && echo 'latest' || true) # 'latest', if branch is master | ||
echo DOCKER_TAGS=""$git_sha $git_tag $latest"" >> $GITHUB_ENV | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ secrets.NVCR_USERNAME }} | ||
password: ${{ secrets.NVCR_TOKEN }} | ||
- name: Make build and push | ||
run: | | ||
echo "Docker tags will be: $DOCKER_TAGS" | ||
for docker_tag in $DOCKER_TAGS; do | ||
make VERSION=$docker_tag image-build-multiarch image-push-multiarch | ||
done | ||
helm-package-publish: | ||
needs: docker-build-push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
- name: Determine versions | ||
run: | | ||
git_tag=$(git describe --tags --exact-match 2>/dev/null | grep -E '${{ env.VALID_TAG_REGEX}}' || true) # git tag, if it exists | ||
git_sha=$(git rev-parse --short HEAD) # short git commit hash | ||
chart_current_version=$(yq '.version' deployment/network-operator/Chart.yaml) | ||
if [ -n "$git_tag" ]; then | ||
app_version=$git_tag | ||
chart_version=${git_tag:1} # without the 'v' prefix | ||
elif [ $(git branch --show-current) == "master" ]; then | ||
app_version=$git_sha | ||
chart_version=$chart_current_version-$git_sha | ||
fi | ||
echo APP_VERSION=""$app_version"" >> $GITHUB_ENV | ||
echo VERSION=""$chart_version"" >> $GITHUB_ENV | ||
- name: NGC authentication | ||
run: | | ||
wget --no-verbose --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/ngc-apps/ngc_cli/versions/3.41.4/files/ngccli_linux.zip -O ngccli_linux.zip | ||
unzip -q ngccli_linux.zip | ||
echo "./ngc-cli" >> $GITHUB_PATH | ||
ngc-cli/ngc config set <<EOF | ||
${{ secrets.NVCR_TOKEN }} | ||
json | ||
nvstaging | ||
mellanox | ||
no-ace | ||
EOF | ||
- name: Make package and push | ||
run: | | ||
make chart-build chart-push | ||
- name: NGC logout | ||
run: | | ||
ngc config clear-cache | ||
ngc config clear |
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