Compare commits

...
Author SHA1 Message Date
Pierre Dubouilh 5e9b85d4aa fixup symlinks listing appearance
closes #123
2025-01-18 21:14:21 +01:00
Pierre Dubouilh 31c8ee518a generalise docker images 2024-08-30 18:50:34 +02:00
Pierre Dubouilh cc703cd70d fixup docker CI 2024-08-30 18:50:34 +02:00
7 changed files with 31 additions and 75 deletions
+4 -9
View File
@@ -6,20 +6,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v1
uses: actions/setup-go@v5
with:
go-version: 1.23.0
id: go
- name: deps
run: npm i -g standard
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
submodules: true
- name: Run
run: make ci
+11 -17
View File
@@ -10,33 +10,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.23.0
id: go
uses: actions/checkout@v4
- name: Set env
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.6.0
uses: docker/setup-qemu-action@v3
- name: Login to DockerHub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and release on dockerhub
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v6
with:
file: support/build.Dockerfile
push: true
@@ -47,17 +39,19 @@ jobs:
run: make build-all
- name: "Release gh release versioned"
uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "builds/*"
bodyFile: "builds/buildout"
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Release gh release latest"
uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
uses: ncipollo/release-action@v1
with:
tag: latest
name: Latest
allowUpdates: true
artifacts: "builds/*"
bodyFile: "builds/buildout"
token: ${{ secrets.GITHUB_TOKEN }}
-39
View File
@@ -1,39 +0,0 @@
name: rc
on:
push:
branches:
- 'rc/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.23.0
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
with:
submodules: true
- name: Run
run: make ci
- name: Build all artifacts
run: make build-all
- name: "Release gh release prerelease"
uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37
with:
allowUpdates: true
prerelease: true
tag: "rc"
artifacts: "builds/*"
token: ${{ secrets.GITHUB_TOKEN }}
+2 -5
View File
@@ -17,10 +17,7 @@ run-ro::
run-extra::
./gossa -verb=true -prefix="/fancy-path/" -k=false -symlinks=true test-fixture
lint-js::
standard
ci:: build-all test lint-js
ci:: build-all test
echo "done"
test::
@@ -66,7 +63,7 @@ build-all:: build
${NOCGO} GOOS=darwin GOARCH=amd64 go build ${FLAGS} -o builds/gossa-mac-x64
${NOCGO} GOOS=darwin GOARCH=arm64 go build ${FLAGS} -o builds/gossa-mac-arm64
${NOCGO} GOOS=windows GOARCH=amd64 go build ${FLAGS} -o builds/gossa-windows.exe
sha256sum builds/*
sha256sum builds/* | tee builds/buildout
clean::
rm -f gossa
+5 -4
View File
@@ -100,8 +100,9 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
p.Title = template.HTML(html.EscapeString(title))
for _, el := range files {
info, err := el.Info()
if err != nil {
info, errInfo := el.Info()
el, err := os.Stat(fullPath + "/" + el.Name())
if err != nil || errInfo != nil {
log.Println("error - cant stat a file", err)
continue
}
@@ -109,7 +110,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
if *skipHidden && strings.HasPrefix(el.Name(), ".") {
continue // dont print hidden files if we're not allowed
}
if *symlinks && info.Mode()&os.ModeSymlink != 0 {
if !*symlinks && info.Mode()&os.ModeSymlink != 0 {
continue // dont follow symlinks if we're not allowed
}
@@ -126,7 +127,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
} else {
sl := strings.Split(name, ".")
ext := strings.ToLower(sl[len(sl)-1])
row := rowTemplate{name, template.URL(href), humanize(info.Size()), ext}
row := rowTemplate{name, template.URL(href), humanize(el.Size()), ext}
p.RowsFiles = append(p.RowsFiles, row)
}
}
+7
View File
@@ -238,6 +238,8 @@ func doTestRegular(t *testing.T, url string, testExtra bool) {
hasListing := strings.Contains(body0, `readme.md`)
body1 = get(t, url+"/support/readme.md")
hasReadme := strings.Contains(body1, `the master branch is automatically built and pushed`)
body2 = get(t, url)
hasMainListing := strings.Contains(body2, `href="support">support/</a>`)
if !testExtra && hasReadme {
t.Fatal("error symlink file reached where illegal")
@@ -249,6 +251,11 @@ func doTestRegular(t *testing.T, url string, testExtra bool) {
} else if testExtra && !hasListing {
t.Fatal("error symlink folder unreachable")
}
if !testExtra && hasMainListing {
t.Fatal("error symlink folder where illegal")
} else if testExtra && !hasMainListing {
t.Fatal("error symlink folder unreachable")
}
if testExtra {
fmt.Println("\r\n~~~~~~~~~~ test symlink mkdir & cleanup")
+2 -1
View File
@@ -1,4 +1,5 @@
FROM golang:1.23.0 AS builder
FROM docker.io/library/golang:1.23.0-alpine AS builder
RUN apk add --no-cache make
WORKDIR /gossaSrc
COPY . /gossaSrc
RUN make