Skip to content

Commit

Permalink
Fix our nightly AWS tests (zarf-dev#1740)
Browse files Browse the repository at this point in the history
## Description

This fixes our nightly AWS tests by allowing them to correctly read the
secrets keys.

## Related Issue

Fixes #N/A

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] Other (security config, docs update, etc)

## Checklist before merging

- [X] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
Racer159 authored May 24, 2023
1 parent 6607c74 commit ae00146
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
11 changes: 0 additions & 11 deletions .github/actions/aws-nightly-creds/action.yaml

This file was deleted.

5 changes: 4 additions & 1 deletion .github/workflows/nightly-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ jobs:
run: make build-cli-linux-amd

- name: Configure AWS Credentials
uses: ./.github/actions/aws-nightly-creds
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
with:
role-to-assume: ${{ secrets.AWS_NIGHTLY_ROLE }}
aws-region: us-east-1

# NOTE: The aws cli will need to be explicitly installed on self-hosted runners
- name: Login to the ECR Registry
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/nightly-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ jobs:
uses: ./.github/actions/packages

- name: Configure AWS Credentials
uses: ./.github/actions/aws-nightly-creds
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
with:
role-to-assume: ${{ secrets.AWS_NIGHTLY_ROLE }}
aws-region: us-east-1
role-duration-seconds: 14400

- name: Build the eks package
run: ./build/zarf package create packages/distros/eks -o build --confirm
Expand Down
21 changes: 12 additions & 9 deletions src/pkg/packager/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,16 +495,19 @@ func (p *Packager) validatePackageChecksums() error {

// validatePackageArchitecture validates that the package architecture matches the target cluster architecture.
func (p *Packager) validatePackageArchitecture() error {
// Attempt to connect to a cluster to get the architecture.
if cluster, err := cluster.NewCluster(); err == nil {
clusterArch, err := cluster.Kube.GetArchitecture()
if err != nil {
return lang.ErrUnableToCheckArch
}
// Ignore this check if the architecture is explicitly "multi"
if p.arch != "multi" {
// Attempt to connect to a cluster to get the architecture.
if cluster, err := cluster.NewCluster(); err == nil {
clusterArch, err := cluster.Kube.GetArchitecture()
if err != nil {
return lang.ErrUnableToCheckArch
}

// Check if the package architecture and the cluster architecture are the same.
if p.arch != clusterArch {
return fmt.Errorf(lang.CmdPackageDeployValidateArchitectureErr, p.arch, clusterArch)
// Check if the package architecture and the cluster architecture are the same.
if p.arch != clusterArch {
return fmt.Errorf(lang.CmdPackageDeployValidateArchitectureErr, p.arch, clusterArch)
}
}
}

Expand Down

0 comments on commit ae00146

Please sign in to comment.