diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml deleted file mode 100644 index 4353228..0000000 --- a/.forgejo/workflows/release.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Release Workflow - -on: - push: - tags: - - '*' - branches: - - main - -jobs: - set-release-target: - runs-on: docker - outputs: - release_cible: ${{ steps.setvar.outputs.release_cible }} - steps: - - name: Déterminer la release cible - id: setvar - run: | - if [[ "${GITHUB_REF}" == refs/tags/* ]]; then - TAG="${GITHUB_REF#refs/tags/}" - echo "release_cible=$TAG" >> $GITHUB_OUTPUT - elif [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then - echo "release_cible=latest" >> $GITHUB_OUTPUT - else - echo "release_cible=unknown" >> $GITHUB_OUTPUT - fi - - - name: Afficher la variable - run: echo "Release cible = ${{ steps.setvar.outputs.release_cible }}" - - build: - runs-on: raw - container: - options: --privileged -v /var/run/docker.sock:/var/run/docker.sock - needs: set-release-target - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Install docker-cli - run: | - apt-get update - apt-get install -y ca-certificates curl - install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc - chmod a+r /etc/apt/keyrings/docker.asc - - # Add the repository to Apt sources: - echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - tee /etc/apt/sources.list.d/docker.list > /dev/null - apt-get update - apt-get install -y docker-ce-cli - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login docker registry - uses: docker/login-action@v2 - with: - username: ${{ forge.ACTOR }} - password: ${{ secrets.PACKAGE }} - registry: ${{ forge.SERVER_URL }} - - - name: Build and push - uses: docker/build-push-action@v4 - with: - context: . - push: true - tags: git.g3e.fr/h6n/users:${{ needs.set-release-target.outputs.release_cible }} - target: release \ No newline at end of file diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml deleted file mode 100644 index 80cbd6c..0000000 --- a/.forgejo/workflows/test.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Test Pipeline - -on: - pull_request: - types: [opened, synchronize] - -jobs: - lint: - runs-on: raw - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Setup golang - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - - name: golangci-lint - uses: https://github.com/golangci/golangci-lint-action@v8 - with: - version: v2.1 - args: --issues-exit-code 0 - - ci-test: - runs-on: raw - container: - options: --privileged -v /var/run/docker.sock:/var/run/docker.sock - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Install docker-cli - run: | - apt-get update - apt-get install -y ca-certificates curl - install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc - chmod a+r /etc/apt/keyrings/docker.asc - - # Add the repository to Apt sources: - echo \ - "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ - $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ - tee /etc/apt/sources.list.d/docker.list > /dev/null - apt-get update - apt-get install -y docker-ce-cli - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Setup golang - uses: actions/setup-go@v5 - with: - go-version: "1.24" - - - name: Build image - run: | - docker build --pull -t users-release --target release . - - - name: Run Test - run: | - bash -ex ./scripts/prepar_test.sh - . ./config/test.src - go test -v ./cmd/ - go install gotest.tools/gotestsum@latest - gotestsum --junitfile report.xml --format testname \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee22eb7..2004cfe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,7 +95,7 @@ release-latest: - build - integration_test -release: +release-front: stage: release image: docker:23.0.3-cli variables: diff --git a/Dockerfile b/Dockerfile index 68ff1a2..e8ee6d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,11 @@ -FROM golang:1.24-alpine AS develop +FROM golang:1.21-alpine AS develop # Changement du répertoire de travail WORKDIR / RUN apk update && apk add --no-cache curl tar && \ - curl -OJ https://git.g3e.fr/api/packages/H6N/generic/minicurl/1.1.0/minicurl-linux-amd64 && \ - mv minicurl-linux-amd64 minicurl && \ - chmod +x ./minicurl + curl -O https://gitlab.g3e.fr/api/v4/projects/34/packages/generic/minicurl/v1.0.0/minicurl_linux_amd64.tar.gz && \ + tar xzvf minicurl_linux_amd64.tar.gz # Changement du répertoire de travail WORKDIR /app diff --git a/README.md b/README.md index bc768c2..361773c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Has this project is in H6N global project his requirement will first meet H6N ne ## Version -v1.2.0: Helium +v1.1.0: Fer ## Developpement diff --git a/cmd/login.go b/cmd/login.go index 75a645f..53fa6e5 100644 --- a/cmd/login.go +++ b/cmd/login.go @@ -5,7 +5,6 @@ import ( "github.com/labstack/echo/v4" logins "gitlab.g3e.fr/h6n/users/internal" - login_lib "gitlab.g3e.fr/h6n/users/lib/login" ) // Login @@ -17,12 +16,12 @@ import ( // @Param request body logins.RequestLogin true "request body" // @Success 200 {object} logins.ResponseLogin func login(c echo.Context) error { - var request login_lib.RequestLogin + var request logins.RequestLogin if err := c.Bind(&request); err != nil { return c.JSON(http.StatusBadRequest, err) } - if response, err := logins.CreateLogin(dbGor, request); err != nil { + if response, err := logins.CreateLogin(db, request); err != nil { return c.JSON(http.StatusBadRequest, "Not a valide user username or password") } else { return c.JSON(http.StatusOK, response) diff --git a/cmd/main.go b/cmd/main.go index 6bf258d..7092f54 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -7,16 +7,15 @@ import ( "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" echoSwagger "github.com/swaggo/echo-swagger" - logins "gitlab.g3e.fr/h6n/users/internal" "gitlab.g3e.fr/h6n/users/lib" - "gitlab.g3e.fr/h6n/users/lib/health" - "gorm.io/gorm" + + "database/sql" _ "github.com/lib/pq" _ "gitlab.g3e.fr/h6n/users/cmd/docs" ) -var dbGor *gorm.DB = nil +var db *sql.DB = nil // Logout // @Tags auth @@ -40,12 +39,16 @@ func isLoggedIn(c echo.Context) error { return c.NoContent(http.StatusNoContent) } +func health(c echo.Context) error { + return c.NoContent(http.StatusOK) +} + func init_database() { var err error connStr := "postgres://acc:totor@postgres:5432/accounts?sslmode=disable" - dbGor, err = logins.Init_database(connStr) + db, err = sql.Open("postgres", connStr) if err != nil { fmt.Println(err) } @@ -55,14 +58,20 @@ func skip_auth(c echo.Context) bool { if c.Request().Method == "POST" && c.Path() == "/" { return true } + if c.Request().Method == "GET" && c.Path() == "/health" { + return true + } if len(c.Path()) > 9 && c.Path()[:9] == "/swagger/" { return true } - return health.IsHealth(c) + return false } func skip_log(c echo.Context) bool { - return health.IsHealth(c) + if c.Request().Method == "GET" && c.Path() == "/health" { + return true + } + return false } // @title Users @@ -100,7 +109,7 @@ func main() { e.GET("/", isLoggedIn) e.POST("/", login) e.DELETE("/", logout) - e.GET("/health", health.Health) + e.GET("/health", health) e.GET("/swagger/*", echoSwagger.WrapHandler) // Start server diff --git a/config/db.sql b/config/db.sql index 9357a40..591d4d8 100644 --- a/config/db.sql +++ b/config/db.sql @@ -1 +1,7 @@ +CREATE TABLE users ( + username TEXT PRIMARY KEY, + email TEXT UNIQUE NOT NULL, + password TEXT NOT NULL +); + INSERT INTO users(username, email, password) VALUES('0000000023', 'root@root.fr', '$2a$14$FU8FKR7pUq4akLThraD9kOu0zY0BuUFASo0xakgWEWbYF2gz20DuG'); \ No newline at end of file diff --git a/docs/release.md b/docs/release.md deleted file mode 100644 index 7831a01..0000000 --- a/docs/release.md +++ /dev/null @@ -1,10 +0,0 @@ -# Release - -## Naming policy - -The naming policy is based on the [periodique table](https://fr.wikipedia.org/wiki/Tableau_p%C3%A9riodique_des_%C3%A9l%C3%A9ments#/media/Fichier:Tableau_p%C3%A9riodique_des_%C3%A9l%C3%A9ments.svg) for this project. - -## Release list - -- [v1.0.0 Helixire](./release/v1.0.0_damian.md) -- [v1.1.0 Fer](./release/v1.1.0_fer.md) diff --git a/docs/release/v1.2.0_helium.md b/docs/release/v1.2.0_helium.md deleted file mode 100644 index 098c527..0000000 --- a/docs/release/v1.2.0_helium.md +++ /dev/null @@ -1,9 +0,0 @@ -# Helium v1.2.0 - -## Release feature - -- Add naming policy -- Add health skip in lib -- Add health path in lib -- Fix ci name for release job -- Change database usage, use Gorm diff --git a/go.mod b/go.mod index f9b2551..7f46fd1 100644 --- a/go.mod +++ b/go.mod @@ -15,11 +15,6 @@ require ( github.com/go-openapi/spec v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect - github.com/jackc/pgpassfile v1.0.0 // indirect - github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect - github.com/jackc/pgx/v5 v5.4.3 // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/labstack/echo/v4 v4.11.4 // indirect github.com/labstack/gommon v0.4.2 // indirect @@ -44,7 +39,5 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/driver/postgres v1.5.7 // indirect - gorm.io/gorm v1.25.9 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index 1ddc90a..e6fc3b3 100644 --- a/go.sum +++ b/go.sum @@ -40,16 +40,6 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= -github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk= -github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= -github.com/jackc/pgx/v5 v5.4.3 h1:cxFyXhxlvAifxnkKKdlxv8XqUf59tDlYjnV5YYfsJJY= -github.com/jackc/pgx/v5 v5.4.3/go.mod h1:Ig06C2Vu0t5qXC60W8sqIthScaEnFvojjj9dSljmHRA= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= -github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -82,7 +72,6 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO/TUk= github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc= github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw= @@ -139,9 +128,5 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM= -gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= -gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8= -gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/internal/createLogin.go b/internal/createLogin.go index 8609ae5..140b350 100644 --- a/internal/createLogin.go +++ b/internal/createLogin.go @@ -1,6 +1,7 @@ package logins import ( + "database/sql" "encoding/base64" "encoding/hex" "errors" @@ -9,9 +10,7 @@ import ( "github.com/biscuit-auth/biscuit-go/v2" "github.com/biscuit-auth/biscuit-go/v2/parser" "gitlab.g3e.fr/h6n/users/lib" - login_lib "gitlab.g3e.fr/h6n/users/lib/login" "golang.org/x/crypto/bcrypt" - "gorm.io/gorm" ) func CheckPasswordHash(password, hash string) bool { @@ -19,14 +18,20 @@ func CheckPasswordHash(password, hash string) bool { return err == nil } -func CreateLogin(db *gorm.DB, request login_lib.RequestLogin) (login_lib.ResponseLogin, error) { - var response login_lib.ResponseLogin +func CreateLogin(db *sql.DB, request RequestLogin) (ResponseLogin, error) { + type ( + User struct { + Username string + EncryptedPassword string + } + ) + var user User + var response ResponseLogin - var user = Users{Email: request.Username} - if err := db.First(&user); err.Error != nil { - return response, err.Error + if err := db.QueryRow("SELECT username, password FROM users WHERE email = $1", request.Username).Scan(&user.Username, &user.EncryptedPassword); err != nil { + return response, err } - if !CheckPasswordHash(request.Password, user.Password) { + if !CheckPasswordHash(request.Password, user.EncryptedPassword) { return response, errors.ErrUnsupported } now := time.Now() diff --git a/internal/databases.go b/internal/databases.go deleted file mode 100644 index 8eb3d96..0000000 --- a/internal/databases.go +++ /dev/null @@ -1,50 +0,0 @@ -package logins - -import ( - "gorm.io/driver/postgres" - "gorm.io/gorm" -) - -type Users struct { - Username string `gorm:"primaryKey"` - Email string `gorm:"unique:users_email_key"` - Password string `gorm:""` -} - -func DropUnusedColumns(DB *gorm.DB, values ...interface{}) { - - for _, dst := range values { - stmt := &gorm.Statement{DB: DB} - if stmt.Parse(dst) != nil { - return - } - fields := stmt.Schema.Fields - columns, _ := DB.Debug().Migrator().ColumnTypes(dst) - - for i := range columns { - found := false - for j := range fields { - if columns[i].Name() == fields[j].DBName { - found = true - break - } - } - if !found { - if DB.Migrator().DropColumn(dst, columns[i].Name()) != nil { - return - } - } - } - } -} - -func Init_database(dsn string) (*gorm.DB, error) { - db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) - if err != nil { - return db, err - } - _ = db.AutoMigrate(&Users{}) - DropUnusedColumns(db, &Users{}) - - return db, nil -} diff --git a/lib/login/struct.go b/internal/struct.go similarity index 93% rename from lib/login/struct.go rename to internal/struct.go index 1ad7774..a32b8fb 100644 --- a/lib/login/struct.go +++ b/internal/struct.go @@ -1,4 +1,4 @@ -package login_lib +package logins type ( // RequestLogin model info diff --git a/lib/health/isHealth.go b/lib/health/isHealth.go deleted file mode 100644 index 7cac15c..0000000 --- a/lib/health/isHealth.go +++ /dev/null @@ -1,10 +0,0 @@ -package health - -import "github.com/labstack/echo/v4" - -func IsHealth(c echo.Context) bool { - if c.Request().Method == "GET" && c.Path() == "/health" { - return true - } - return false -} diff --git a/lib/health/status.go b/lib/health/status.go deleted file mode 100644 index 0d9ea5e..0000000 --- a/lib/health/status.go +++ /dev/null @@ -1,11 +0,0 @@ -package health - -import ( - "net/http" - - "github.com/labstack/echo/v4" -) - -func Health(c echo.Context) error { - return c.NoContent(http.StatusOK) -} diff --git a/lib/initBiscuit.go b/lib/initBiscuit.go index ed74eaf..0853db2 100644 --- a/lib/initBiscuit.go +++ b/lib/initBiscuit.go @@ -3,7 +3,6 @@ package lib import ( "crypto/ed25519" "crypto/rand" - "fmt" "io" "os" "time" @@ -23,12 +22,7 @@ func InitLoginBiscuit() error { if file, err := os.Create(filePrivateKey); err != nil { return err } else { - defer func() { - if cerr := file.Close(); cerr != nil { - // ici tu peux logger ou faire quelque chose - fmt.Printf("Erreur à la fermeture: %v\n", cerr) - } - }() + defer file.Close() if _, err = io.WriteString(file, string(PrivateKey)); err != nil { return err @@ -40,12 +34,7 @@ func InitLoginBiscuit() error { if file, err := os.Create(filePublicKey); err != nil { return err } else { - defer func() { - if cerr := file.Close(); cerr != nil { - // ici tu peux logger ou faire quelque chose - fmt.Printf("Erreur à la fermeture: %v\n", cerr) - } - }() + defer file.Close() if _, err = io.WriteString(file, string(PublicKey)); err != nil { return err @@ -58,12 +47,7 @@ func InitLoginBiscuit() error { if file, err := os.Open(filePrivateKey); err != nil { return err } else { - defer func() { - if cerr := file.Close(); cerr != nil { - // ici tu peux logger ou faire quelque chose - fmt.Printf("Erreur à la fermeture: %v\n", cerr) - } - }() + defer file.Close() PrivateKey, err = io.ReadAll(file) if err != nil { @@ -73,12 +57,7 @@ func InitLoginBiscuit() error { if file, err := os.Open(filePublicKey); err != nil { return err } else { - defer func() { - if cerr := file.Close(); cerr != nil { - // ici tu peux logger ou faire quelque chose - fmt.Printf("Erreur à la fermeture: %v\n", cerr) - } - }() + defer file.Close() PublicKey, err = io.ReadAll(file) if err != nil { @@ -107,12 +86,7 @@ func InitGlobalBiscuit() error { if file, err := os.Open(filePrivateKey); err != nil { return err } else { - defer func() { - if cerr := file.Close(); cerr != nil { - // ici tu peux logger ou faire quelque chose - fmt.Printf("Erreur à la fermeture: %v\n", cerr) - } - }() + defer file.Close() PrivateKey, err = io.ReadAll(file) if err != nil { @@ -122,12 +96,7 @@ func InitGlobalBiscuit() error { if file, err := os.Open(filePublicKey); err != nil { return err } else { - defer func() { - if cerr := file.Close(); cerr != nil { - // ici tu peux logger ou faire quelque chose - fmt.Printf("Erreur à la fermeture: %v\n", cerr) - } - }() + defer file.Close() PublicKey, err = io.ReadAll(file) if err != nil { diff --git a/scripts/prepar_test.sh b/scripts/prepar_test.sh index 032e9af..2db967f 100644 --- a/scripts/prepar_test.sh +++ b/scripts/prepar_test.sh @@ -1,9 +1,20 @@ #!/bin/bash + +cat <> /etc/apk/repositories +http://ftp.halifax.rwth-aachen.de/alpine/v3.16/main +http://ftp.halifax.rwth-aachen.de/alpine/v3.16/community +ENDFILE +apk update +apk add docker docker-cli-compose docker version docker compose version +docker load --input "$IMAGE_TYPE-$IMAGE_VERSION-release.tar.gz" +docker tag $CI_REGISTRY_IMAGE:$IMAGE_VERSION-release $IMAGE_TYPE:latest + +cat < docker-compose.yml +version: '3.1' -cat < compose.yml services: postgres: image: postgres:15.2-alpine3.17 @@ -18,7 +29,7 @@ services: timeout: 5s retries: 5 users: - image: users-release + image: $IMAGE_TYPE volumes: - ./docker/keys:/keys depends_on: