<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fetch API Data and Display as Table</title>
<style>
table {
width: 100%;
border-collapse: collapse;
}
th, td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>API Data Displayed as Table</h2>
<div id="table-container"></div> <!-- Container for the table -->
<script>
// Define the API endpoint and the bearer token
const apiEndpoint = "YOUR_API_ENDPOINT_HERE";
const bearerToken = "YOUR_BEARER_TOKEN_HERE";
// Function to fetch data from the API
function fetchData() {
// Setup the request headers with the authorization token
const headers = new Headers({
"Authorization": `Bearer ${bearerToken}`,
"Content-Type": "application/json"
});
// Make the fetch request to the API
fetch(apiEndpoint, { method: "GET", headers: headers })
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
// Call the function to display the data as a table
displayTable(data);
})
.catch(error => {
console.error('There has been a problem with your fetch operation:', error);
});
}
// Function to display JSON data as a table
function displayTable(data) {
// Assume data is an array of objects
// Create table
const table = document.createElement("table");
table.setAttribute("border", "1");
// Add table header
const thead = document.createElement("thead");
const headerRow = document.createElement("tr");
if(data.length > 0){
Object.keys(data[0]).forEach(key => {
const th = document.createElement("th");
th.textContent = key;
headerRow.appendChild(th);
});
}
thead.appendChild(headerRow);
table.appendChild(thead);
// Add table body
const tbody = document.createElement("tbody");
data.forEach(item => {
const row = document.createElement("tr");
Object.values(item).forEach(value => {
const td = document.createElement("td");
td.textContent = value;
row.appendChild(td);
});
tbody.appendChild(row);
});
table.appendChild(tbody);
// Append the table to the document body (or any other container)
document.getElementById('table-container').appendChild(table);
}
// Call the function to fetch data and display it
fetchData();
</script>
</body>
</html>
Using release plugin from Altassian
The release-start
goal in the JGit-Flow Maven plugin is used to create a release branch from the 'develop' branch.
In the Git Flow workflow, a release branch is a type of branch where you prepare for a new production release. You use this branch for the final polishing and bug fixing. This includes updating version numbers, documentation, small fixes, and other final touches. Once these tasks are done, the release branch is merged into 'master' and tagged with a version number. It's also merged back into 'develop', which may have progressed since the release was initiated.
When you execute the release-start
goal, it does the following:
- Checks to make sure you're not already on a release branch.
- Switches to the 'develop' branch.
- Pulls the latest changes from the remote 'develop' branch.
- Creates a new branch 'release/<
>' from 'develop'. - Pushes the new branch to the remote repository.
- If the 'autoVersionSubmodules' configuration is set to true, it will also update all the versions of the Maven modules to the release version.
This allows you to isolate your release preparation work from ongoing development work on the 'develop' branch, so that development can continue to progress independently of the release preparations.
To accomplish this task, you can make use of a tool like jgitflow-maven-plugin
which simplifies working with the git flow branching model by providing Maven goals for many git flow actions like starting/finishing feature, release, and hotfix branches.
First, add the jgitflow-maven-plugin
to your pom.xml
:
<build>
<plugins>
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version> <!-- please check the latest version -->
<configuration>
<flowInitContext>
<masterBranchName>master</masterBranchName>
</flowInitContext>
</configuration>
</plugin>
<!-- other plugins -->
</plugins>
</build>
You can use the jgitflow:release-start
and jgitflow:release-finish
goals to manage your release branches:
- Start the release branch:
mvn jgitflow:release-start
(this will prompt for a version number) - Finish the release branch:
mvn jgitflow:release-finish
(this will merge the release branch back intomaster
anddevelop
, delete the release branch, and push changes to the remote repository)
The jgitflow:release-start
goal will prompt you for the version number. If you want to avoid being prompted, you can specify the release version on the command line, like this: mvn jgitflow:release-start -DreleaseVersion=1.0.0
However, please note that this plugin doesn't support changing the project version. You would have to manually change the version in your pom.xml
files or use the versions-maven-plugin
to manage your project versions:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version> <!-- please check the latest version -->
</plugin>
To set a new version for your project, you can use this command: mvn versions:set -DnewVersion=1.0.0
Remember to commit the changes after updating the version: git commit -am "Bump version to 1.0.0"
Jenkins pipeline with multiple stages after a stage
pipeline {
agent any
stages {
stage('Stage 1') {
// Add your Stage 1 steps here
}
stage('Stage 2') {
// Add your Stage 2 steps here
}
stage('Stage 3') {
parallel {
stage('Stage 3.1') {
when {
expression {
return currentBuild.result == 'SUCCESS'
}
}
steps {
// Add your Stage 3.1 steps here
}
}
stage('Stage 3.2') {
when {
expression {
return currentBuild.result == 'SUCCESS'
}
}
steps {
// Add your Stage 3.2 steps here
}
}
}
}
stage('Stage 4') {
parallel {
stage('Stage 4.1') {
when {
expression {
return currentBuild.result == 'SUCCESS' && previousStageStatus('Stage 3.1') == 'SUCCESS'
}
}
steps {
// Add your Stage 4.1 steps here
}
}
stage('Stage 4.2') {
when {
expression {
return currentBuild.result == 'SUCCESS' && previousStageStatus('Stage 3.2') == 'SUCCESS'
}
}
steps {
// Add your Stage 4.2 steps here
}
}
}
}
}
}
def previousStageStatus(stageName) {
def build = currentBuild.rawBuild
def previousStage = build.getPreviousBuild()?.getExecutor()?.getCurrentExecutable()?.getParent()
def result = previousStage?.getBuildByNumber(build.getNumber() - 1)?.getStepByName(stageName)?.getResult()
return result?.toString()
}
List all directories with the branch details
# Specify the directory path
$directoryPath = "C:\Your\Directory\Path"
# Change to the specified directory
Set-Location -Path $directoryPath
# Get the list of subdirectories
$subDirectories = Get-ChildItem -Directory
# Loop through each subdirectory
foreach ($subDirectory in $subDirectories) {
# Get the last updated date of the subdirectory
$lastUpdated = $subDirectory.LastWriteTime
# Change to the subdirectory
Set-Location -Path $subDirectory.FullName
# Get the current Git branch
$gitBranch = git rev-parse --abbrev-ref HEAD
# Print the subdirectory, last updated date, and Git branch in a "|" separated format
Write-Host "$($subDirectory.Name)|$lastUpdated|$gitBranch"
}
Hello world!
Welcome to WordPress. This is your first post. Edit or delete it, then start writing!