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

[Enhacement] Include branch name when checking pipeline existence #4566

Open
faisalriazz opened this issue Nov 18, 2024 · 9 comments
Open

[Enhacement] Include branch name when checking pipeline existence #4566

faisalriazz opened this issue Nov 18, 2024 · 9 comments
Assignees
Labels
aspire azdo Azure DevOps customer-reported identify a customer issue needs-author-feedback waiting for author to respond pipelines question
Milestone

Comments

@faisalriazz
Copy link

I am using azd version 1.11.0 to deploy Aspire Project using below mentioned link
https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/aca-deployment-github-actions?tabs=windows&pivots=azure-pipelines

Issue :
Project is already created and initiated using azd init, my current branch is dev.

  • using this command azd pipeline config --provider azdo
  • service connection is created automatically
  • PAT is configured with required permissions.

First deployment from let us say Branch dev works fine and deployment started.
Second deployment from let us say Branch Stagging but different container app envoironment using azd init using the same PAT created in previous step and Azure service connection ( az connection) fails with error .
AZURE_ENV_NAME is invalid.

@rajeshkamal5050
Copy link
Contributor

@vhvb1989 can you triage it?

@vhvb1989
Copy link
Member

Hello @faisalriazz , can you please add more details about what you are doing? What do you mean by second deployment?
How are you trying to use different branches in your Azure DevOps?

When you run azd pipeline config, azd takes care of setting the CI/CD pipeline based on your current local git branch. Any other branches are not configured, only the one you are currently using. Azd sets ENV VARS for the pipeline that it creates.

Also, the documentation from https://learn.microsoft.com/en-us/dotnet/aspire/deployment/azure/aca-deployment-github-actions?tabs=windows&pivots=azure-pipelines is a little outdated. You don't need to manually create the pipeline definition. You can just run azd pipeline config and azd will create it for you if it is missing.

@vhvb1989 vhvb1989 added the needs-author-feedback waiting for author to respond label Nov 18, 2024
@faisalriazz
Copy link
Author

faisalriazz commented Nov 19, 2024

@vhvb1989 Thanks for your reply. Here are the details that i have done so far.

  • In Branch main-cicd which i have created from main branch.
  • I just run azd pipeline config and follow the procedure.
  • Pipeline is working fine.

Now i repeated the same process but this time the Branch is main.

  • Pipeline executed sucessfully.
    Issue is that both pipelines are trigerred for any change in one the branches either main or main-cicd.
  • I have updated the triggers in azure-dev.yml file in both branches as

main-cicd branch

trigger:
  branches:
    include:
      - main-cicd
    exclude:
      - main

main branch

trigger:
  branches:
    include:
      - main
    exclude:
      - main-cicd

** Still both pipelines are triggered on change in any of the branch**

  • I override the YML triggers in pipeline setting with the same as written in YML file.
  • Now invidiual pipelines are trigerred individually but this is not understandable.
  • Note I tried changing the name of the azure-dev.yml file in one branch and executed the pipeline but it failed in infrastructure provisioning task.
  • Ultimately i have to revert the filename back to azure-dev.yml
  • Would you please explain what is wrong with my procedure

@faisalriazz
Copy link
Author

@rajeshkamal5050 @vhvb1989
Would you please update

@rajeshkamal5050
Copy link
Contributor

@v-xuto can you repro the above steps and update? cc @vhvb1989

@vhvb1989
Copy link
Member

@faisalriazz , thank you for the details.

Every time you run azd pipeline config, azd creates a definition for the pipeline and the branch you are currently using. The pipeline is the same, however. Azd currently does not support handling more than one pipeline for you.

I remember we built it this way to prevent creating a new pipeline after every azd pipeline config. Instead, we check if the pipeline already exist and update its definition. This is causing you an issue b/c you are re-running with a different branch.

I'll see if we can include the branch name while we check if the pipeline exists or not. In that case, you should see a different pipeline created for each branch.

Since this might take me some time, please be patient :)

@faisalriazz
Copy link
Author

Thanks @vhvb1989 for the update, will be waiting anxiously for new version of azd :)

@v-weiyding
Copy link
Member

v-weiyding commented Nov 21, 2024

@rajeshkamal5050 Based on the main and main-cicd branches, we can only create one pipeline instead of two separate pipelines. Moreover, within the same pipeline, when we make changes to the main and main-cicd branches and push them, only the corresponding branch's azure-dev.yml file will be executed.

@faisalriazz
Copy link
Author

@v-weiyding Thanks for your input. Yes that can done but i want to keep it separate pipelines for the sake of simplicity.
I will be waiting for update azd version.

@rajeshkamal5050 rajeshkamal5050 changed the title Deploy Aspire Project from different Branches within the same project. Infrastructure provision step failing [Enhacement] Include branch name when checking pipeline existence Nov 26, 2024
@rajeshkamal5050 rajeshkamal5050 added this to the Backlog milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspire azdo Azure DevOps customer-reported identify a customer issue needs-author-feedback waiting for author to respond pipelines question
Projects
None yet
Development

No branches or pull requests

4 participants