Skip to content

Commit

Permalink
USHIFT-2543: add overrides for CI scripts
Browse files Browse the repository at this point in the history
Add the ability to override settings used by the CI scripts for local
developer workflows.
  • Loading branch information
dhellmann committed Mar 7, 2024
1 parent a26de20 commit ea03b00
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ ansible/*.txt
test/variables.yaml
test/scenario_settings.sh
__pycache__
test/dev_overrides.sh
23 changes: 23 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -698,3 +698,26 @@ The keys are then mounted for the job and copied to the `~/.aws/config` and

> The procedure assumes that the `microshift-build-cache-<region>` bucket exists
> in the appropriate region.
### Local Developer Overrides

In some cases, it is necessary to override default values used by the
CI scripts to make them work in the local environment. If the file
`./test/dev_overrides.sh` exists, it is sourced by the test framework
scripts after initializing the common defaults and before computing
any per-script defaults.

For example, creating the file with this content

```
#!/bin/bash
export AWS_BUCKET_NAME=microshift-build-cache-us-west-2
export CI_JOB_NAME=local-dev
```

will ensure that a valid AWS bucket is used as the source of image
cache data and that scripts that check for the CI job name will have a
name pattern set to compare.

NOTE: Include the shebang line with the shell set and export variables
to avoid issues with the shellcheck linter.
8 changes: 8 additions & 0 deletions test/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,11 @@ SCENARIO_BUILD_TAG_PREV="$(date -d "yesterday" '+%y%m%d')"
# The location of the awscli binary.
# shellcheck disable=SC2034 # used elsewhere
AWSCLI="${OUTPUTDIR}/bin/aws"

# The location of developer overrides files.
DEV_OVERRIDES="${TESTDIR}/dev_overrides.sh"
if [ -f "${DEV_OVERRIDES}" ]; then
# The file will not exist, so we should not ask shellcheck to look for it.
# shellcheck disable=SC1090
source "${DEV_OVERRIDES}"
fi
8 changes: 8 additions & 0 deletions test/dev_overrides.sh.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Variables used by ci_phase_iso_build.sh
export AWS_BUCKET_NAME=microshift-build-cache-us-west-2
export CI_JOB_NAME=local-dev

# build_images.sh
export SKIP_LOG_COLLECTION=true

0 comments on commit ea03b00

Please sign in to comment.