Skip to content
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

Action var tests off #2632

Merged
merged 32 commits into from
Aug 26, 2024
Merged

Conversation

BrianCashProf
Copy link
Contributor

Reference Issues or PRs

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

Any other comments?

Following the changes introduced in #2569, We have decided to use action variables instead of local environment variables.
These action variables must be set at the repo level and can be set by forks differently to the main repository without merge conflicts.
The action variable is set as a binary boolean (with 0 being false and 1 being true).

testing action variable
testing action variables
Remove environment variable in favor of action variable.
Replacing env with action var.
Replacing env with action vars.
replace env with action vars.
changing boolean to binary
changed to binary boolean
Changed conditional to binary boolean.
Changed to binary boolean.
@viniciusdc
Copy link
Contributor

viniciusdc commented Aug 15, 2024

Hi @BrianCashProf, thanks for opening the PR; I wonder if the variable could be boolean instead of the int. Also, while reading the docs for variables again, I noticed this:

If a configuration variable has not been set, the return value of a context referencing the variable will be an empty string.

So, one thing that we could also change is the primary condition, so instead of looking for a value of the given variable (and this requiring that to be preset), we could use:

if: ${{ ! vars.NO_PROVIDER_CREDENTIALS_*** }}

I've attested that this works as expected, but with the caveat that those variables must be set in the repository settings of a given fork.

@BrianCashProf
Copy link
Contributor Author

Hi @BrianCashProf, thanks for opening the PR; I wonder if the variable could be boolean instead of the int. Also, while reading the docs for variables again, I noticed this:

If a configuration variable has not been set, the return value of a context referencing the variable will be an empty string.

So, one thing that we could also change is the primary condition, so instead of looking for a value of the given variable (and this requiring that to be preset), we could use:

if: ${{ ! vars.NO_PROVIDER_CREDENTIALS_*** }}

I've attested that this works as expected, but with the caveat that those variables must be set in the repository settings of a given fork.

I'll take a look into this method.

@BrianCashProf
Copy link
Contributor Author

BrianCashProf commented Aug 23, 2024

Hi @BrianCashProf, thanks for opening the PR; I wonder if the variable could be boolean instead of the int. Also, while reading the docs for variables again, I noticed this:

If a configuration variable has not been set, the return value of a context referencing the variable will be an empty string.

So, one thing that we could also change is the primary condition, so instead of looking for a value of the given variable (and this requiring that to be preset), we could use:

if: ${{ ! vars.NO_PROVIDER_CREDENTIALS_*** }}

I've attested that this works as expected, but with the caveat that those variables must be set in the repository settings of a given fork.

In my initial test I have realized I had used double quotes. Regular boolean works fine like such:


if: ${{ vars.NO_PROVIDER_CREDENTIALS_***  == ’false’ }}

The code you provided:

if: ${{ ! vars.NO_PROVIDER_CREDENTIALS_*** }}

Works well in the sense that if you do not set the variable at all it will run the pipeline but if you do set the variable to any value at all it will skip the pipeline.

If by default we want to run the pipeline and the flag only needs to be placed to skip the pipeline; then this is my suggestion:


if: ${{  vars.NO_PROVIDER_CREDENTIALS_*** != true }}
```


This way the following happen:
- If var not set, we run the test
- If var set to false, we run the test
- If var set to true, we skip the test

@tylergraff
Copy link
Contributor

If by default we want to run the pipeline and the flag only needs to be placed to skip the pipeline; then this is my suggestion

@BrianCashProf Yes we do want to run by default and only skip if the flag is set accordingly. Please make your suggested change. Once that is committed, is there anything else needed before this PR can be merged?

Copy link
Contributor

@viniciusdc viniciusdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BrianCashProf, make sure they follow the standard you suggested above. NO_PROVIDER_CREDENTIALS_AWS != 'true' to vars.NO_PROVIDER_CREDENTIALS_AZURE == 0. Also, now that we removed the previous check-for-credentials job and we are also relying on different variables for each provider anyway, I suggest that we rename the variable to SKIP_***_INTEGRATION_TEST.

Update to SKIP_AWS_INTEGRATION_TEST var
Update to SKIP_AZURE_INTEGRATION_TEST var.
update SKIP_AZURE_INTEGRATION_TEST
Update SKIP_DO_INTEGRATION_TEST var.
update SKIP_GCP_INTEGRATION_TEST var
echo "::set-output name=provider_credentials_aws::1"
fi

# Must have action variable NO_PROVIDER_CREDENTIALS_AWS set up in the repo as a binary boolean.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I've removed the comment.

Copy link
Contributor

@viniciusdc viniciusdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @BrianCashProf

@viniciusdc viniciusdc merged commit fb3cb04 into nebari-dev:develop Aug 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants