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

Fix pipeline create templates #261

Merged
merged 1 commit into from
Apr 11, 2024
Merged

Fix pipeline create templates #261

merged 1 commit into from
Apr 11, 2024

Conversation

HadwaAbdelhalem
Copy link
Contributor

This PR fixes a bug when running Symphony CLI cmd: symphony pipeline config for Azure devops where pipelines were creating without the expected variables.

I tested the changes and where able to successfully configure an azure devops repo for terraform and run the Deploy pipeline.

@HadwaAbdelhalem HadwaAbdelhalem self-assigned this Apr 9, 2024
@HadwaAbdelhalem HadwaAbdelhalem requested a review from a team as a code owner April 9, 2024 21:57
Copy link

github-actions bot commented Apr 9, 2024

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 3 0 0.01s
❌ JSON jsonlint 3 1 0.18s
✅ REPOSITORY gitleaks yes no 0.06s
✅ SPELL lychee 3 0 0.04s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Copy link

github-actions bot commented Apr 9, 2024

Modules tests Results

3 tests   3 ✅  8m 14s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 95071d3.

Copy link

github-actions bot commented Apr 9, 2024

Creating environment with name: "10bdf0" using commit: "95071d32c63c74639ff630e15949e2ee460b0c87".

The environment will be destroyed after the workflow completes.
To preserve it, add the "preserve-pr-environment" label to the PR.

Copy link

github-actions bot commented Apr 9, 2024

E2E Tests Results

1 tests   1 ✅  1m 32s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 95071d3.

Copy link
Member

@maniSbindra maniSbindra left a comment

Choose a reason for hiding this comment

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

Tested the fix. lgtm.

Copy link
Member

@DariuszPorowski DariuszPorowski left a comment

Choose a reason for hiding this comment

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

This change provides invalid json syntax. Expected is to use quote.
Any linter will block this, like in this case with checks: https://github.com/microsoft/symphony/actions/runs/8622793305/job/23634701234#step:5:189

Instead of producing invalid/non-standard json, let's fix the issue in script where root-cause is, like this example: https://github.com/microsoft/symphony/blob/main/scripts/install/providers/azdo/azdo.sh#L368
is
sed <"$SCRIPT_DIR/templates/pipeline-authorize.json" 's~__PIPELINE_ID__~'"${_pipeId}"'~'
should be
sed <"$SCRIPT_DIR/templates/pipeline-authorize.json" 's~__PIPELINE_ID__~'${_pipeId}'~'

@hattan
Copy link
Contributor

hattan commented Apr 11, 2024

This change provides invalid json syntax. Expected is to use quote. Any linter will block this, like in this case with checks: https://github.com/microsoft/symphony/actions/runs/8622793305/job/23634701234#step:5:189

Instead of producing invalid/non-standard json, let's fix the issue in script where root-cause is, like this example: https://github.com/microsoft/symphony/blob/main/scripts/install/providers/azdo/azdo.sh#L368 is sed <"$SCRIPT_DIR/templates/pipeline-authorize.json" 's~__PIPELINE_ID__~'"${_pipeId}"'~' should be sed <"$SCRIPT_DIR/templates/pipeline-authorize.json" 's~__PIPELINE_ID__~'${_pipeId}'~'

@DariuszPorowski - We actually started going down this path, but the sed command is slightly more complicated. Adding a quote like so breaks the interpolation.

In this case it really comes down that the fact that json file isn't a json file, it's a template file. So it shouldn't be considered json and not subject to linting rules. Put another way, it's expected that it's not valid json.

We will add a future story to move these to from json to .json.tmpl template files.

@DariuszPorowski DariuszPorowski self-requested a review April 11, 2024 16:47
Copy link
Member

@DariuszPorowski DariuszPorowski left a comment

Choose a reason for hiding this comment

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

to fix in the future with templates: #261 (comment)

@hattan hattan merged commit 9ad95f1 into main Apr 11, 2024
12 of 13 checks passed
@hattan hattan deleted the fix_azdo_pipeline_config branch April 11, 2024 18:38
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.

4 participants