Skip to content

Commit

Permalink
azure devops pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzheng422 committed Jan 17, 2025
1 parent 03403fe commit c02296a
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions redhat/ocp4/4.16/2024.12.rhdh.ado.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,80 @@ spec:
owner: user:default/azure.demo.user.01_wzhlab.top
```
# run the azure devops pipeline
After the repository is created, you can create a pipeline in the azure devops to build and deploy the application.
For free user, we need to change the project/repo into public to run the pipeline with self-host agent.
First we need to active the `public project` in our organization.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-50-09.png)

Next, we go to a `project` under the organization, and change the project's visibility into `public`.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-52-51.png)

To run with self-host agent, we need to add agent into a agent pool, we use the build-in agent pool `Default`.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-52-19.png)

And click the `new agent`, and follow the steps to install the agent on your machine. Here we can see an agent is added into the pool.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-53-35.png)

The detailed steps to install the agent is popped up.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-54-15.png)

After created agent, we need to create `quay.io`'s credential in the azure devops, which is used by the pipeline to upload the container image. In azure devops, it is `service connections`. Open `project setting`, and under the `pipeline`, click `service connections`, and click `new service connection`,

![](imgs/2024.12.rhdh.ado.md/2025-01-17-19-02-28.png)

and select `docker registry`.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-19-02-58.png)

In the next step, input the following information:

- Docker Registry: `quay.io`
- Docker ID: your quay.io username, a robot account is recommended, which is more secure.
- Docker Password: your quay.io password
- Service connection name: `quay.io`

![](imgs/2024.12.rhdh.ado.md/2025-01-17-19-03-53.png)

Now, we are ready to run the pipeline, first, we need to create a `pipeline` in the azure devops, click `pipelines` in the left menu, and click `new pipeline`.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-55-01.png)

Select `azure repos git`, because our pipeline definition file is in the azure devops repository.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-55-21.png)

Next, select the repository that contains the pipeline definition file.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-55-49.png)

The pipeline definition file is `azure-pipelines.yml`, which is in the root of the repository, and is loaded automatically. Click `run` will run and save the pipeline.

You can check the source code of the `azure-pipelines.yml` file here, and change it based on your own env:
- [azure-pipelines.yml](https://github.com/wangzheng422/red-hat-developer-hub-software-templates/blob/wzh-hack/templates/azure/dotnet-frontend/skeleton/azure-pipelines.yml)

![](imgs/2024.12.rhdh.ado.md/2025-01-17-18-58-49.png)

Wait a moment, it will trigger a build on the self-host agent, and the build will be successful. The container image will be uploaded to `quay.io`. Here is the build result.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-19-00-13.png)

And we can see the container image is created on `quay.io`.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-19-00-52.png)

Deploy the container image `quay.io/wangzheng422/qimgs:azure-devops-demo-latest` on openshift, expose the service (the app port is default to 5000), and access the application.

![](imgs/2024.12.rhdh.ado.md/2025-01-17-19-25-13.png)

The application is running on openshift, and we can access it via the route. It is a very simple dotnet application.

# end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c02296a

Please sign in to comment.