-
Notifications
You must be signed in to change notification settings - Fork 1
ci workflow with amd support only #10
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,145 @@ | ||
| # Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| default: | ||
| image: docker:dind | ||
| services: | ||
| - name: docker:dind | ||
| command: ["--experimental"] | ||
|
|
||
| variables: | ||
| BUILD_MULTI_ARCH_IMAGES: "true" | ||
|
|
||
| stages: | ||
| - image-build | ||
| - test | ||
| - scan | ||
| - release | ||
| - ngc-publish | ||
|
|
||
| # Define the distribution targets | ||
| .dist-distroless: | ||
| variables: | ||
| DIST: distroless | ||
|
|
||
| # Define the platform targets | ||
| .platform-amd64: | ||
| variables: | ||
| PLATFORM: linux/amd64 | ||
|
|
||
| .platform-arm64: | ||
| variables: | ||
| PLATFORM: linux/arm64 | ||
|
|
||
| # Make buildx available as a docker CLI plugin | ||
| .buildx-setup: | ||
| before_script: | ||
| - export BUILDX_VERSION=v0.16.0 | ||
| - apk add --no-cache curl | ||
| - mkdir -p ~/.docker/cli-plugins | ||
| - curl -sSLo ~/.docker/cli-plugins/docker-buildx "https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-amd64" | ||
| - chmod a+x ~/.docker/cli-plugins/docker-buildx | ||
|
|
||
| - docker buildx create --use --platform=linux/amd64,linux/arm64 | ||
|
|
||
| - '[[ -n "${SKIP_QEMU_SETUP}" ]] || docker run --rm --privileged multiarch/qemu-user-static --reset -p yes' | ||
|
|
||
| # Define test helpers | ||
| .integration: | ||
| stage: test | ||
| variables: | ||
| VERSION: "${CI_COMMIT_SHORT_SHA}" | ||
| IMAGE_NAME: "${CI_REGISTRY_IMAGE}" | ||
| except: | ||
| variables: | ||
| - $CI_COMMIT_MESSAGE =~ /\[skip[ _-]tests?\]/i | ||
| - $SKIP_TESTS | ||
| before_script: | ||
| - apk add --no-cache make bash jq | ||
| - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" | ||
| - docker pull "${IMAGE_NAME}:${VERSION}" | ||
| script: | ||
| - make -f deployments/container/Makefile test-${DIST} | ||
|
|
||
| # Download the regctl binary for use in the release steps | ||
| .regctl-setup: | ||
| before_script: | ||
| - export REGCTL_VERSION=v0.7.0 | ||
| - apk add --no-cache curl | ||
| - mkdir -p bin | ||
| - curl -sSLo bin/regctl https://github.com/regclient/regclient/releases/download/${REGCTL_VERSION}/regctl-linux-amd64 | ||
| - chmod a+x bin/regctl | ||
| - export PATH=$(pwd)/bin:${PATH} | ||
|
|
||
| # .release forms the base of the deployment jobs which push images to the CI registry. | ||
| # This is extended with the version to be deployed (e.g. the SHA or TAG) and the | ||
| # target os. | ||
| .release: | ||
| stage: release | ||
| variables: | ||
| # Define the source image for the release | ||
| IMAGE_NAME: "${CI_REGISTRY_IMAGE}" | ||
| VERSION: "${CI_COMMIT_SHORT_SHA}" | ||
| # OUT_IMAGE_VERSION is overridden for external releases | ||
| OUT_IMAGE_VERSION: "${CI_COMMIT_SHORT_SHA}" | ||
| before_script: | ||
| - !reference [.regctl-setup, before_script] | ||
| # We ensure that the OUT_IMAGE_VERSION is set | ||
| - 'echo Version: ${OUT_IMAGE_VERSION} ; [[ -n "${OUT_IMAGE_VERSION}" ]] || exit 1' | ||
| # In the case where we are deploying a different version to the CI_COMMIT_SHA, we | ||
| # need to tag the image. | ||
| # Note: a leading 'v' is stripped from the version if present | ||
| - apk add --no-cache make bash | ||
| script: | ||
| - 'echo "Logging in to CI registry ${CI_REGISTRY}"' | ||
| - regctl registry login "${CI_REGISTRY}" -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" | ||
| - '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || echo "Logging in to output registry ${OUT_REGISTRY}"' | ||
| - '[ ${CI_REGISTRY} = ${OUT_REGISTRY} ] || regctl registry login "${OUT_REGISTRY}" -u "${OUT_REGISTRY_USER}" -p "${OUT_REGISTRY_TOKEN}"' | ||
|
|
||
| # Since OUT_IMAGE_NAME and OUT_IMAGE_VERSION are set, this will push the CI image to the | ||
| # Target | ||
| - make -f deployments/container/Makefile push-${DIST} | ||
|
|
||
| # Define a staging release step that pushes an image to an internal "staging" repository | ||
| # This is triggered for all pipelines (i.e. not only tags) to test the pipeline steps | ||
| # outside of the release process. | ||
| .release:staging: | ||
| extends: | ||
| - .release | ||
| variables: | ||
| OUT_REGISTRY_USER: "${NGC_REGISTRY_USER}" | ||
| OUT_REGISTRY_TOKEN: "${NGC_REGISTRY_TOKEN}" | ||
| OUT_REGISTRY: "${NGC_REGISTRY}" | ||
| OUT_IMAGE_NAME: "${NGC_STAGING_REGISTRY}/nvidia-sandbox-device-plugin" | ||
|
|
||
| # Define an external release step that pushes an image to an external repository. | ||
| # This includes a devlopment image off master. | ||
| .release:external: | ||
| extends: | ||
| - .release | ||
| rules: | ||
| - if: $CI_COMMIT_TAG | ||
| variables: | ||
| OUT_IMAGE_VERSION: "${CI_COMMIT_TAG}" | ||
| - if: $CI_COMMIT_BRANCH == $RELEASE_DEVEL_BRANCH | ||
| variables: | ||
| OUT_IMAGE_VERSION: "${DEVEL_RELEASE_IMAGE_VERSION}" | ||
|
|
||
| # Define the release jobs | ||
| release:staging-distroless: | ||
| extends: | ||
| - .release:staging | ||
| - .dist-distroless | ||
| needs: | ||
| - image-distroless | ||
This file contains hidden or 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,3 @@ | ||
| # https://docs.gha-runners.nvidia.com/platform/apps/copy-pr-bot/#configuration | ||
|
|
||
| enabled: true |
This file contains hidden or 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 hidden or 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,48 @@ | ||
| # Copyright 2025 NVIDIA CORPORATION | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: CI Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "pull-request/[0-9]+" | ||
| - main | ||
| - ci | ||
| - release-* | ||
|
|
||
| jobs: | ||
| code-scanning: | ||
| uses: ./.github/workflows/code_scanning.yaml | ||
|
|
||
| variables: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| steps: | ||
| - name: Generate Commit Short SHA | ||
| id: version | ||
| run: echo "version=$(echo $GITHUB_SHA | cut -c1-8)" >> "$GITHUB_OUTPUT" | ||
|
|
||
| golang: | ||
| needs: [variables] | ||
| secrets: inherit | ||
| uses: ./.github/workflows/golang.yaml | ||
|
|
||
| image: | ||
| uses: ./.github/workflows/images.yaml | ||
| needs: [variables, golang, code-scanning] | ||
| secrets: inherit | ||
| with: | ||
| version: ${{ needs.variables.outputs.version }} |
This file contains hidden or 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,53 @@ | ||
| # Copyright 2025 NVIDIA CORPORATION | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: "CodeQL" | ||
|
|
||
| on: | ||
| workflow_call: {} | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - synchronize | ||
| branches: | ||
| - main | ||
| - ci | ||
| - release-* | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze Go code with CodeQL | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 360 | ||
| permissions: | ||
| security-events: write | ||
| packages: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@v4 | ||
| with: | ||
| languages: go | ||
| build-mode: manual | ||
|
|
||
| - shell: bash | ||
| run: | | ||
| make build | ||
|
|
||
| - name: Perform CodeQL Analysis | ||
| uses: github/codeql-action/analyze@v4 | ||
| with: | ||
| category: "/language:go" |
This file contains hidden or 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,80 @@ | ||
| # Copyright 2025 NVIDIA CORPORATION | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: Golang | ||
|
|
||
| on: | ||
| workflow_call: {} | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Unit test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Get Golang version | ||
| id: vars | ||
| run: | | ||
| GOLANG_VERSION=$(./scripts/golang-version.sh) | ||
| echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION := }" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: ${{ env.GOLANG_VERSION }} | ||
|
|
||
| - name: Run unit tests | ||
| run: make test | ||
|
|
||
| - name: Generate coverage report | ||
| run: make coverage | ||
|
|
||
| - name: Upload to Coveralls | ||
| uses: coverallsapp/github-action@v2 | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| file: coverage.out | ||
|
|
||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Get Golang version | ||
| id: vars | ||
| run: | | ||
| GOLANG_VERSION=$(./scripts/golang-version.sh) | ||
| echo "GOLANG_VERSION=${GOLANG_VERSION##GOLANG_VERSION ?= }" >> $GITHUB_ENV | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: ${{ env.GOLANG_VERSION }} | ||
|
|
||
| # - name: Setup Go Proxy | ||
| # id: setup-go-proxy | ||
| # uses: nv-gha-runners/setup-artifactory-go-proxy@main | ||
| # - env: | ||
| # GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }} | ||
|
|
||
| - name: Build | ||
| run: | | ||
| make build |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't have ngc-publish here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file isn't used by github. Its used by Nvidia private runners.