Commit f90ba7eb authored by Khanh Nguyen's avatar Khanh Nguyen
Browse files

init files

parent 27329d3a
Pipeline #45027 failed with stages
in 18 seconds
image: openjdk:latest
stage: build
- javac
stage: test
- javac -cp "./junit-platform-console-standalone-1.8.1.jar"
- java -jar junit-platform-console-standalone-1.8.1.jar -cp "." -c SiteGenTest
stage: deploy
- javac
- java SiteGen
- public
- main
# Sample GitLab Project
# DEVOPS demonstration
Build your own CI/CD pipeline to the Gitlab environment through following steps:
- Create new project to either UTU gitlab or ​​ if you don’t have an UTU account
- Use the project template as a basis for your project
- The CI/CD pipeline should fail at the testing phase; read the console logs for all the phases and see what goes wrong
- Create new branch to investigate the situation; verify that the pipeline still fails
- Fix the situation by modifying the Java source code file based on the unit testing report found from the CI/CD console log
- When the testing phase goes green, merge the branch to the main branch
- The resulting web page generated by the Java application should now be deployed to the Gitlab Pages; Access the web pages via Gitlab setting and give public access to the resulting web site
- Read through the .gitlab-ci.yml file and try to understand what each line does
- Prepare to demonstrate you CI/CD pipeline and explain how it works
Note: Each step can be done using the Gitlab online tools and editors
This sample project shows how a project in GitLab looks for demonstration purposes. It contains issues, merge requests and Markdown files in many branches,
named and filled with lorem ipsum.
You can look around to get an idea how to structure your project and, when done, you can safely delete this project.
[Learn more about creating GitLab projects.](
import java.nio.file.*;
import java.util.*;
class SiteGen {
static String siteTitle = "My favorite movies";
static List<String> movieList = List.of(
"Star Wars",
"Star Trek",
"Battlestar Galactica"
static String htmlString =
"<html>" +
"<head><title>" + siteTitle + "</title></head>" +
"<body>" +
"<h1>" + siteTitle + "</h1>" +
"<ul>" + -> "<li>"+ i + "</li>").collect(Collectors.joining()) + "</ul>" +
"</body>" +
public static void main(String args[]) throws Exception {
Files.write(Paths.get("public/index.html"), htmlString.getBytes());
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class SiteGenTest {
public void testHtmlString() {
String correctHtml = "<html><head><title>My favorite movies</title></head><body><h1>My favorite movies</h1><ul><li>Star Wars</li><li>Star Trek</li><li>Battlestar Galactica</li></ul></body></html>";
Assertions.assertEquals(correctHtml, SiteGen.htmlString);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment