Skip to content

Commit

Permalink
patch: gridd and license optional
Browse files Browse the repository at this point in the history
Made the client token download and addition of the gridd template conditionally added based on whether the flags are supplied.
  • Loading branch information
drew-viles authored Dec 5, 2023
1 parent caa12ee commit 7ecafab
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Validate on Pull Request
on:
workflow_dispatch:
pull_request:
types: [ opened, reopened, edited ]
types: [ opened, reopened, synchronized ]

jobs:
lint:
Expand Down Expand Up @@ -39,16 +39,19 @@ jobs:
packages: write
id-token: write
steps:
- name: Get Branch Name
shell: bash
run: |
echo "branch_name=${{ github.event.pull_request.head.ref }}" >> "$GITHUB_ENV"
- name: Build Local Baski Image
uses: eschercloudai/container-security-action@v0.0.4
if: github.event_name != 'pull_request'
id: build-and-scan-baski
with:
image-repo: ghcr.io
repo-username: ${{ github.repository_owner }}
repo-password: ${{ secrets.GITHUB_TOKEN }}
image-name: baski
image-tag: ${{ github.ref_name }}
image-tag: ${{ env.branch_name }}
check-severity: CRITICAL
trivyignore-from-s3: true
aws-endpoint: "https://nl1.eschercloud.com:6780"
Expand All @@ -64,14 +67,13 @@ jobs:
dockerfile-path: docker/baski
- name: Build Local Baski Server Image
uses: eschercloudai/container-security-action@v0.0.4
if: github.event_name != 'pull_request'
id: build-and-scan-server
with:
image-repo: ghcr.io
repo-username: ${{ github.repository_owner }}
repo-password: ${{ secrets.GITHUB_TOKEN }}
image-name: baski-server
image-tag: ${{ github.ref_name }}
image-tag: ${{ env.branch_name }}
check-severity: CRITICAL
trivyignore-from-s3: true
aws-endpoint: "https://nl1.eschercloud.com:6780"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
aws-secret-key: ${{secrets.AWS_SECRET_KEY}}
s3-bucket: "trivyignores"
s3-path: "baski"
add-latest-tag: false
publish-image: false
cosign-private-key: ${{secrets.COSIGN_KEY}}
cosign-password: ${{secrets.COSIGN_PASSWORD}}
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [ 2023/12/05 - v0.2.0 ]

### Changed/Added
* Made gridd template and license download optional, so they're not automatically added when not required.

## [ 2023/11/28 - v0.1.0 ]

### Changed/Added
Expand Down
18 changes: 14 additions & 4 deletions pkg/providers/packer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,25 @@ func InitConfig(o *flags.BuildOptions) *Buildconfig {
if o.AddNvidiaSupport {
customRoles = "nvidia"

ansibleUserVars = fmt.Sprintf("nvidia_s3_url=%s nvidia_bucket=%s nvidia_bucket_access=%s nvidia_bucket_secret=%s nvidia_ceph=%t nvidia_installer_location=%s nvidia_tok_location=%s gridd_feature_type=%d",
ansibleUserVars = fmt.Sprintf("nvidia_s3_url=%s nvidia_bucket=%s nvidia_bucket_access=%s nvidia_bucket_secret=%s nvidia_ceph=%t nvidia_installer_location=%s",
o.Endpoint,
o.NvidiaBucket,
o.AccessKey,
o.SecretKey,
o.IsCeph,
o.NvidiaInstallerLocation,
o.NvidiaTOKLocation,
o.NvidiaGriddFeatureType)
o.NvidiaInstallerLocation)

if o.NvidiaTOKLocation != "" {
ansibleUserVars = fmt.Sprintf("%s nvidia_tok_location=%s",
ansibleUserVars,
o.NvidiaTOKLocation)
}

if o.NvidiaGriddFeatureType != -1 {
ansibleUserVars = fmt.Sprintf("%s gridd_feature_type=%d",
ansibleUserVars,
o.NvidiaGriddFeatureType)
}
}

if o.AdditionalImages != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/flags/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (o *BuildOptions) AddFlags(cmd *cobra.Command, imageBuilderRepo string) {
StringVarWithViper(cmd, &o.NvidiaBucket, viperNvidiaPrefix, "nvidia-bucket", "", "The bucket name in which the NVIDIA components are stored")
StringVarWithViper(cmd, &o.NvidiaInstallerLocation, viperNvidiaPrefix, "nvidia-installer-location", "", "The NVIDIA installer location in the bucket - this must be acquired from NVIDIA and uploaded to your bucket")
StringVarWithViper(cmd, &o.NvidiaTOKLocation, viperNvidiaPrefix, "nvidia-tok-location", "", "The NVIDIA .tok file location in the bucket - this must be acquired from NVIDIA and uploaded to your bucket")
IntVarWithViper(cmd, &o.NvidiaGriddFeatureType, viperNvidiaPrefix, "nvidia-gridd-feature-type", 4, "The gridd feature type - See https://docs.nvidia.com/license-system/latest/nvidia-license-system-quick-start-guide/index.html#configuring-nls-licensed-client-on-linux for more information")
IntVarWithViper(cmd, &o.NvidiaGriddFeatureType, viperNvidiaPrefix, "nvidia-gridd-feature-type", -1, "The gridd feature type - See https://docs.nvidia.com/license-system/latest/nvidia-license-system-quick-start-guide/index.html#configuring-nls-licensed-client-on-linux for more information")

cmd.MarkFlagsRequiredTogether("enable-nvidia-support", "nvidia-driver-version", "nvidia-bucket", "nvidia-installer-location", "nvidia-tok-location", "nvidia-gridd-feature-type")
cmd.MarkFlagsRequiredTogether("cni-version", "crictl-version", "kubernetes-version")
Expand Down

0 comments on commit 7ecafab

Please sign in to comment.