Create ApplicationβοΈ
In EDP, all software components, such as applications, libraries, Terraform infrastructures, and automated tests, are termed as codebases. EDP provides flexible methods for scaffolding these components.
This guide will lead you through creating a Go application using the Gin framework. The EDP Marketplace will be utilized to streamline the application creation process.
Application OnboardingβοΈ
To create the first application, complete the instructions below:
-
In the EDP Portal, navigate to
EDP
->Marketplace
. -
In the
Marketplace
section, select Web Applications with Gin Framework: -
In the appeared window, define the following values and click Apply:
- Component name:
my-go-gin-app
- Description:
My first application
- Git server:
github
- Repository name:
<github_account_name>/my-go-gin-app
- Codebase versioning type:
edp
- Start version from:
0.1.0
- Suffix:
SNAPSHOT
- Component name:
-
As soon as the codebase is created, navigate to it via the notification at the bottom left corner:
Build ApplicationβοΈ
Having created the Go application, proceed to build it by performing the following actions:
-
In the component details page, expand the application and click the Go to the Source Code button:
-
In the opened Source Code, create new branch called test.
-
In the SonarCloud organization page, copy the value of the SonarCloud organization name:
-
In the test branch in GitHub, open the
sonar-project.properties
file and include thesonar.language=go
,sonar.scanner.force-deprecated-java-version=true
, andsonar.organization
parameters wheresonar.organization
is equal to the value copied in the previous step, resulting in the following configuration:sonar.projectKey=my-go-gin-app sonar.projectName=my-go-gin-app sonar.go.coverage.reportPaths=coverage.out sonar.test.inclusions=**/*_test.go sonar.exclusions=**/cmd/**,**/deploy/**,**/deploy-templates/**,**/*.groovy,**/config/** sonar.language=go sonar.organization=<organization-key> sonar.scanner.force-deprecated-java-version=true
-
Commit the changes.
-
Create and merge a pull request:
-
Run the
kubectl edit task
command to update the version of the image that is used in the sonarqube-scanner task from4.7
to5.0.1
:- image: sonarsource/sonar-scanner-cli:5.0.1 name: sonar-scanner workingDir: $(workspaces.source.path) env: - name: SONAR_TOKEN valueFrom: secretKeyRef: name: $(params.ci-sonarqube) key: token command: - sonar-scanner
Note
This step is necessary due to SonarCloud's discontinuation of support for Java 11, which is utilized in the sonarqube-scanner image. This solution is designed specifically for the EDP 3.7.x and lower versions. Users of EDP 3.8.x and higher versions can skip this step.
-
In the component details page, click the Trigger build pipeline run button:
-
Enable port-forwarding for the edp-tekton-dashboard service (in case ingress is not deployed):
kubectl port-forward service/edp-tekton-dashboard 64372:8080 -n edp
-
To observe the build pipeline status, click the tree diagram icon in the Diagram column:
-
Once the build is failed, click the failed stage name to open the Tekton pipeline run:
The initial pipeline is expected to fail, primarily due to SonarCloud intricacies. It is imperative to set a Quality Gate in SonarCloud after the initial pipeline run and subsequently re-trigger the build pipeline. After the pipeline failure, a new project is expected to appear in the organization.
-
In the SonarCloud organization, select the newly appeared project and click the Set New Code Definition button:
-
In the New Code page, set the Previous version option and click Save:
-
In EDP Portal, trigger build pipeline run one more time and wait until the pipeline run is finished.
Build pipelines are designed to generate an executable image of an application. Once built, the image can be run in a target environment.
Now that you have successfully built an application, the next step involves creating an environment for deployment. To deploy the application, it is necessary to install and integrate Argo CD. To deploy the application, we need to install and integrate Argo CD. To do this, navigate to the Integrate Argo CD page.