skel still doesn't work properly,sadly
ci/woodpecker/push/woodpecker Pipeline failed
Details
ci/woodpecker/push/woodpecker Pipeline failed
Details
parent
82bccb9d1f
commit
39c969ec51
|
@ -6,3 +6,5 @@
|
|||
5533801d-70e3-4c21-9942-82d20930c789
|
||||
5533801d-70e3-4c21-9942-82d20930c789
|
||||
5533801d-70e3-4c21-9942-82d20930c789
|
||||
5533801d-70e3-4c21-9942-82d20930c789
|
||||
5533801d-70e3-4c21-9942-82d20930c789
|
||||
|
|
|
@ -17,6 +17,9 @@ port: 80
|
|||
# Files that will be copied into container on startup
|
||||
skel: /etc/podterminal/skel.tar.gz
|
||||
skel_target: /config
|
||||
skel_chown: true
|
||||
# Currently useless
|
||||
skel_owner: "abc"
|
||||
ssl: false
|
||||
ssl_cert: /etc/ssl/certs/ssl-cert-snakeoil.pem
|
||||
ssl_cert_key: /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
|
|
19
pods/skel.go
19
pods/skel.go
|
@ -1,25 +1,31 @@
|
|||
package pods
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
||||
"github.com/containers/podman/v4/pkg/bindings"
|
||||
"github.com/containers/podman/v4/pkg/bindings/containers"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// CopySkelToContainer copies an Archive into the containers root
|
||||
func CopySkelToContainer(id string) error {
|
||||
chownBool := viper.GetBool("skel_chown")
|
||||
log.Println("Copying skel Archive to container")
|
||||
var err error
|
||||
conn, err := bindings.GetClient(Socket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
options := containers.CopyOptions{
|
||||
Chown: &chownBool,
|
||||
}
|
||||
|
||||
fileInfo, err := os.Stat(viper.GetString("skel"))
|
||||
|
||||
if err != nil {
|
||||
log.Println("Could not access Skel archive")
|
||||
return err
|
||||
|
@ -33,9 +39,14 @@ func CopySkelToContainer(id string) error {
|
|||
}
|
||||
defer file.Close()
|
||||
|
||||
params := url.Values{}
|
||||
params, err := options.ToParams()
|
||||
if err != nil {
|
||||
log.Println("Could not parse skel options", err)
|
||||
return err
|
||||
}
|
||||
params.Set("path", viper.GetString("skel_target"))
|
||||
|
||||
fmt.Println("Container", id, " Params: ", params.Encode())
|
||||
response, err := conn.DoRequest(
|
||||
Socket,
|
||||
file,
|
||||
|
@ -50,9 +61,11 @@ func CopySkelToContainer(id string) error {
|
|||
}
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
log.Println("Error putting archive into container: ")
|
||||
log.Println("Error putting archive into container: ", response.StatusCode, response.Body)
|
||||
return err
|
||||
}
|
||||
log.Println(response.StatusCode, response.Body)
|
||||
|
||||
// Manually chown the Directory, because podmans chown is sometimes unreliable
|
||||
return response.Process(nil)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ func readConfigFile() {
|
|||
viper.SetDefault("dri", false)
|
||||
viper.SetDefault("dir_node", "/dev/dri/renderD128")
|
||||
viper.SetDefault("skel", "/etc/podterminal/skel.tar.gz")
|
||||
viper.SetDefault("skel_chown", false)
|
||||
viper.SetDefault("skel_target", "/")
|
||||
viper.SetDefault("skel_owner", "abc")
|
||||
viper.SetDefault("block_filebrowser", false)
|
||||
viper.SetDefault("envvars",
|
||||
map[string]string{
|
||||
|
|
|
@ -57,16 +57,8 @@ func containerProxy(c *gin.Context) {
|
|||
c.Abort()
|
||||
}
|
||||
|
||||
err = pods.CopySkelToContainer(ct)
|
||||
|
||||
if err != nil {
|
||||
c.HTML(
|
||||
500,
|
||||
"Error",
|
||||
fmt.Sprintf("[%s] Could not copy skel archive to container: %v", sessionID, err),
|
||||
)
|
||||
c.Abort()
|
||||
}
|
||||
// Soft fail Skel
|
||||
_ = pods.CopySkelToContainer(ct)
|
||||
|
||||
proxies[ct], err = createReverseProxy(fmt.Sprintf("http://%s:3000", ctip))
|
||||
|
||||
|
|
Loading…
Reference in New Issue