Compare commits

...

57 Commits
main ... test

Author SHA1 Message Date
5fe2d96f42 Add semantic versioning, when pushing to test PATH is incremented by 1 2025-06-10 23:55:45 +05:30
33682a4425 Adding git config 2025-06-10 23:45:42 +05:30
5b8735bf58 Adding git config 2025-06-10 23:44:55 +05:30
fe591b8af0 Minor bugfix 2025-06-10 23:32:54 +05:30
b7c6149fb7 Correcting syntax 2025-06-10 23:24:03 +05:30
bdb4c77ac3 Trying to multiple jobs 2025-06-10 23:15:19 +05:30
5307ba0307 Trying to use 2025-06-10 23:14:11 +05:30
6262c84535 Trying to use 2025-06-10 21:46:10 +05:30
8720810c46 Trying to pass variables between steps using outputs 2025-06-10 21:39:17 +05:30
66fbfc5d69 Trying to pass variables between steps using outputs 2025-06-10 21:29:54 +05:30
cd4b2ae2d8 Trying to pass variables between steps using outputs 2025-06-10 21:21:39 +05:30
1980b49272 Trying to figure out RCA 2025-06-06 02:24:53 +05:30
38753791d7 Trying to figure out RCA 2025-06-06 02:20:03 +05:30
40a536ddcf Trying to figure out RCA 2025-06-06 02:19:18 +05:30
2b0e0eb9c4 Trying to figure out RCA 2025-06-06 02:14:30 +05:30
d7cda65f21 Trying to figure out RCA 2025-06-06 02:11:28 +05:30
5760f9e714 Trying to figure out RCA 2025-06-06 02:06:12 +05:30
05214000af Trying to figure out RCA 2025-06-06 02:02:19 +05:30
c24abc76be Trying to figure out RCA 2025-06-06 01:54:20 +05:30
856748edb7 Trying to figure out RCA 2025-06-06 01:46:54 +05:30
7203877b27 Trying to figure out RCA 2025-06-06 01:41:34 +05:30
27576d6023 Trying to figure out RCA 2025-06-06 01:36:57 +05:30
c045dae894 Trying to figure out RCA 2025-06-06 01:33:41 +05:30
4afeb9f6b2 Trying to figure out RCA 2025-06-06 01:11:09 +05:30
0bc90d5d77 Trying to figure out RCA 2025-06-06 01:07:33 +05:30
80b55fd993 Trying to figure out RCA 2025-06-06 00:48:35 +05:30
61df434e0d Trying to figure out RCA 2025-06-06 00:31:06 +05:30
cc64b7c748 Trying to figure out RCA 2025-06-06 00:30:25 +05:30
df2a50d356 Trying to figure out RCA 2025-06-06 00:02:30 +05:30
c6ded4a74d Trying to figure out RCA 2025-06-05 23:43:57 +05:30
36050aec95 Trying to figure out RCA 2025-06-05 23:26:25 +05:30
ccc65aef8d Trying to figure out RCA 2025-06-05 23:23:44 +05:30
3742fb53af Trying a different base image 2025-06-05 23:13:27 +05:30
3bf981ac05 Checking if cut is installed on gitea runner 2025-06-05 22:05:51 +05:30
005863c998 Using cut to increment version 2025-06-05 21:45:30 +05:30
1cd63d6d3d Adding awk 2025-06-05 02:36:19 +05:30
f6bd7573a6 using fetch-depth 0 as specified in https://github.com/actions/checkout/issues/1781 2025-06-05 02:29:02 +05:30
b66ba60028 Fetching tags explicitly 2025-06-05 02:19:59 +05:30
8f1f6e4f99 Minor bugfix 2025-06-05 01:59:40 +05:30
5fb59032cb Adding tags to release and images 2025-06-05 01:52:45 +05:30
196cf74a72 Adding default profile test for gradle build test task 2025-06-04 01:50:41 +05:30
ebd65ccbbe Changing verbosity of gradle logs 2025-06-04 01:34:19 +05:30
c5d01ece01 Adding profiles for different OpenAPI server URLS in different environments 2025-06-04 01:27:34 +05:30
ec7d3299df Changes derver in OpenAPI Config to avoid CORS 2025-06-01 17:29:24 +05:30
6cd3524ca0 Fixing broken image creation 2025-05-29 00:13:49 +05:30
8bc84a3202 Changing some bruno env variables 2025-05-28 23:54:27 +05:30
87f779450d Changing open api springdoc version 2025-05-28 20:39:53 +05:30
620b9f2788 Merge branch 'test' into docker_compose 2025-05-28 19:43:47 +05:30
4483bf5a1b Adding env agnostic docker compose file 2025-05-28 19:15:50 +05:30
882b127818 Fixing issue related to not beaing able to execute gradlew 2025-05-28 19:01:11 +05:30
585dd26a7b Workflow to only build on PR and building an image only on push to test 2025-05-28 18:55:38 +05:30
d3f0797e33 Adding field path to ingress 2025-05-27 01:08:07 +05:30
c3726d8e3e ci (#11)
Reviewed-on: Hithomelabs/CFTunnels#11
Reviewed-by: kruti <krutis0201@gmail.com>
2025-05-26 19:34:09 +00:00
27457eb4a7 Bruno api request and env changes 2025-05-27 00:46:57 +05:30
8fe909196a Making changes to workflow pipeline (#10)
Reviewed-on: Hithomelabs/CFTunnels#10
2025-05-25 18:04:50 +00:00
a5df219e50 Making changes to workflow pipeline 2025-05-25 23:32:39 +05:30
a6c74d4443 workflows (#2) (#3)
Reviewed-on: Hithomelabs/CFTunnels#2
Co-authored-by: hitanshu310 <hitanshu98@gmail.com>
Co-committed-by: hitanshu310 <hitanshu98@gmail.com>
Reviewed-on: Hithomelabs/CFTunnels#3
Co-authored-by: hitanshu310 <hitanshu98@gmail.com>
Co-committed-by: hitanshu310 <hitanshu98@gmail.com>
2025-05-24 23:08:56 +00:00
17 changed files with 173 additions and 8 deletions

4
.env.example Normal file
View File

@ -0,0 +1,4 @@
CLOUDFLARE_ACCOUNT_ID="<cloudflare account id>"
CLOUDFLARE_API_KEY="<cloudflare account key>"
CLOUDFLARE_EMAIL="<cloudflare email>"
ENV="<deployment env>"

View File

@ -0,0 +1,20 @@
name: sample gradle build and test
run-name: Build started by $ {{gitea.actor}}
on:
pull_request:
branches: [test]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: JDK setup
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Gradle build
run: ./gradlew build --info

View File

@ -0,0 +1,64 @@
name: sample gradle build and test
run-name: Build started by $ {{gitea.actor}}
on:
push:
branches: [test]
jobs:
tag:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.new_version.outputs.new_version }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get new version
id: new_version
run: |
VERSION=$(git describe --tags --abbrev=0)
echo ${VERSION}
MAJOR=$(echo ${VERSION} | cut -d "." -f 1)
MINOR=$(echo ${VERSION} | cut -d "." -f 2)
PATCH=$(echo ${VERSION} | cut -d "." -f 3)
NEW_PATCH=$(( ${PATCH} + 1))
echo ${NEW_PATCH}
echo "new_version=$(echo "${MAJOR}.${MINOR}.${NEW_PATCH}")" >> $GITHUB_OUTPUT
build_tag_push:
runs-on: ubuntu-latest
needs: tag
container:
image: catthehacker/ubuntu:act-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: JDK setup
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v3
- name: Create and push tag
run: |
echo "NEW_VERSION=${{ needs.tag.outputs.new_version }}"
git config --global user.name "${{gitea.actor}}"
git config --global user.email "${{ gitea.actor }}@users.noreply.github.com"
git tag -a ${{ needs.tag.outputs.new_version }} -m "Pushing new version ${{ needs.tag.outputs.new_version }}"
git push origin ${{ needs.tag.outputs.new_version }}
- name: Log in to Gitea Docker Registry
uses: docker/login-action@v3
with:
registry: 'http://192.168.0.100:8928'
username: hitanshu
password: ${{ secrets.TOKEN }}
- name: Gradle build
run: ./gradlew bootBuildImage --imageName=192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }}
- name: Tag image as test
run: docker tag 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }} 192.168.0.100:8928/hithomelabs/cftunnels:test
- name: Push to Gitea Registry
run: |
docker push 192.168.0.100:8928/hithomelabs/cftunnels:test
docker push 192.168.0.100:8928/hithomelabs/cftunnels:${{ needs.tag.outputs.new_version }}

View File

@ -5,7 +5,7 @@ meta {
}
get {
url: http://localhost8080/cloudflare/tunnels
url: {{base_url}}/cloudflare/tunnels
body: none
auth: none
}

View File

@ -5,7 +5,7 @@ meta {
}
get {
url: http://localhost:8080/cloudflare/tunnel/{{tunnel_id}}
url: {{base_url}}/cloudflare/tunnel/{{tunnel_id}}
body: none
auth: none
}

View File

@ -4,8 +4,16 @@ meta {
seq: 2
}
post {
url: http://localhost:8080/cloudflare/tunnel/50df9101-f625-4618-b7c5-100338a57124
body: none
put {
url: {{base_url}}/cloudflare/tunnel/{{tunnel_id}}/add
body: json
auth: none
}
body:json {
{
"service": "http://192.168.0.100:3457",
"hostname": "random.hithomelabs.com",
"originRequest": {}
}
}

View File

@ -5,7 +5,15 @@ meta {
}
put {
url: http://localhost:8080/cloudflare/tunnel/50df9101-f625-4618-b7c5-100338a57124/add
body: none
url: {{base_url}}/cloudflare/tunnel/{{tunnel_id}}/delete
body: json
auth: none
}
body:json {
{
"service": "http://192.168.0.100:6000",
"hostname": "random.hithomelabs.com",
"originRequest": {}
}
}

View File

@ -0,0 +1,4 @@
vars {
tunnel_id: 50df9101-f625-4618-b7c5-100338a57124
base_url: http://localhost:8080
}

View File

@ -1,3 +1,4 @@
vars {
tunnel_id: 50df9101-f625-4618-b7c5-100338a57124
base_url: https://testcf.hithomelabs.com
}

View File

@ -13,12 +13,16 @@ java {
}
}
test {
systemProperty 'spring.profiles.active', 'test'
}
repositories {
mavenCentral()
}
dependencies {
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.0.3'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.5'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

12
docker-compose.yaml Normal file
View File

@ -0,0 +1,12 @@
services:
app:
image: gitea.hithomelabs.com/hithomelabs/cftunnels:${ENV}
container_name: cftunnels_${ENV}
environment:
- CLOUDFLARE_ACCOUNT_ID=${CLOUDFLARE_ACCOUNT_ID}
- CLOUDFLARE_API_KEY=${CLOUDFLARE_API_KEY}
- CLOUDFLARE_EMAIL=${CLOUDFLARE_EMAIL}
- ENV=${ENV}
ports:
- 5002:8080
restart: unless-stopped

View File

@ -0,0 +1,26 @@
package com.hithomelabs.CFTunnels.Config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
@Configuration
public class OpenApiConfig {
@Value("${api.baseUrl}")
private String baseUrl;
@Bean
public OpenAPI openAPI(){
Server httpsServer = new Server().url(baseUrl);
OpenAPI openApi = new OpenAPI();
ArrayList<Server> servers = new ArrayList<>();
servers.add(httpsServer);
openApi.setServers(servers);
return openApi;
}
}

View File

@ -8,6 +8,16 @@ public class Ingress {
private String service;
private String hostname;
private Map<String, Object> originRequest;
private String path;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public static boolean deleteByHostName(List<Ingress> ingressList, String toBeDeleted){
return ingressList.removeIf(ingress -> ingress.getHostname() != null && ingress.getHostname().equals(toBeDeleted));

View File

@ -0,0 +1 @@
api.baseUrl=http://localhost:8080

View File

@ -0,0 +1 @@
api.baseUrl=https://cftunnels.hithomelabs.com

View File

@ -0,0 +1 @@
api.baseUrl=https://testcf.hithomelabs.com

View File

@ -2,3 +2,4 @@ spring.application.name=CFTunnels
cloudflare.accountId=${CLOUDFLARE_ACCOUNT_ID}
cloudflare.apiKey=${CLOUDFLARE_API_KEY}
cloudflare.email=${CLOUDFLARE_EMAIL}
spring.profiles.active=${ENV}