Merge pull request #1 from OpenCHAMI/rehome

move to OpenCHAMI and update changelog
This commit is contained in:
Alex Lovell-Troy 2023-11-03 17:25:06 +02:00 committed by GitHub
commit 44e75aee5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 179 additions and 91 deletions

4
.devcontainer/.env Normal file
View file

@ -0,0 +1,4 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=postgres
POSTGRES_HOSTNAME=localhost

13
.devcontainer/Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM mcr.microsoft.com/devcontainers/go:1-1.20-bullseye
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment the next lines to use go get to install anything else you need
# USER vscode
# RUN go get -x <your-dependency-or-tool>
# USER root
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

View file

@ -0,0 +1,28 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go-postgres
{
"name": "Go & PostgreSQL",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"features": {
"ghcr.io/marcozac/devcontainer-features/goreleaser:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Configure tool-specific properties.
// "customizations": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5432],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View file

@ -0,0 +1,38 @@
version: '3.8'
volumes:
postgres-data:
services:
app:
build:
context: .
dockerfile: Dockerfile
env_file:
# Ensure that the variables in .env match the same variables in devcontainer.json
- .env
volumes:
- ../..:/workspaces:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
network_mode: service:db
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)
db:
image: postgres:latest
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
env_file:
# Ensure that the variables in .env match the same variables in devcontainer.json
- .env
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
# (Adding the "ports" property to this file will not forward from a Codespace.)

View file

@ -10,10 +10,10 @@ builds:
- amd64 - amd64
dockers: dockers:
- image_templates: - image_templates:
- bikeshack/{{.ProjectName}}:latest - ghcr.io/openchami/{{.ProjectName}}:latest
- bikeshack/{{.ProjectName}}:{{ .Tag }} - ghcr.io/openchami/{{.ProjectName}}:{{ .Tag }}
- bikeshack/{{.ProjectName}}:{{ .Major }} - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}
- bikeshack/{{.ProjectName}}:{{ .Major }}.{{ .Minor }} - ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}
build_flag_templates: build_flag_templates:
- "--pull" - "--pull"
- "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.created={{.Date}}"

View file

@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.0.5] - 2023-11-02
### Added
* Ability to update firmware
* Refactored connection handling for faster scanning
* Updated to refelct home at github.com/OpenCHAMI
* Updated to reflect ghcr.io as container home
## [Unreleased] ## [Unreleased]
## [0.0.1] - 2023-09-14 ## [0.0.1] - 2023-09-14

View file

@ -1,10 +1,10 @@
package cmd package cmd
import ( import (
magellan "github.com/OpenChami/magellan/internal" magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/OpenChami/magellan/internal/api/smd" "github.com/OpenCHAMI/magellan/internal/api/smd"
"github.com/OpenChami/magellan/internal/db/sqlite" "github.com/OpenCHAMI/magellan/internal/db/sqlite"
"github.com/OpenChami/magellan/internal/log" "github.com/OpenCHAMI/magellan/internal/log"
"github.com/cznic/mathutil" "github.com/cznic/mathutil"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"

View file

@ -3,7 +3,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/OpenChami/magellan/internal/db/sqlite" "github.com/OpenCHAMI/magellan/internal/db/sqlite"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"

View file

@ -6,8 +6,8 @@ import (
"os" "os"
"path" "path"
magellan "github.com/OpenChami/magellan/internal" magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/OpenChami/magellan/internal/db/sqlite" "github.com/OpenCHAMI/magellan/internal/db/sqlite"
"github.com/cznic/mathutil" "github.com/cznic/mathutil"
"github.com/spf13/cobra" "github.com/spf13/cobra"

View file

@ -1,8 +1,8 @@
package cmd package cmd
import ( import (
magellan "github.com/OpenChami/magellan/internal" magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/OpenChami/magellan/internal/log" "github.com/OpenCHAMI/magellan/internal/log"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/OpenChami/magellan module github.com/OpenCHAMI/magellan
go 1.20 go 1.20

View file

@ -4,7 +4,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/OpenChami/magellan/internal/util" "github.com/OpenCHAMI/magellan/internal/util"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
) )

View file

@ -6,7 +6,7 @@ package smd
import ( import (
"fmt" "fmt"
"github.com/OpenChami/magellan/internal/util" "github.com/OpenCHAMI/magellan/internal/util"
// hms "github.com/alexlovelltroy/hms-smd" // hms "github.com/alexlovelltroy/hms-smd"
) )

View file

@ -12,10 +12,10 @@ import (
"sync" "sync"
"time" "time"
"github.com/OpenChami/magellan/internal/log" "github.com/OpenCHAMI/magellan/internal/log"
"github.com/OpenChami/magellan/internal/api/smd" "github.com/OpenCHAMI/magellan/internal/api/smd"
"github.com/OpenChami/magellan/internal/util" "github.com/OpenCHAMI/magellan/internal/util"
"github.com/Cray-HPE/hms-xname/xnames" "github.com/Cray-HPE/hms-xname/xnames"
bmclib "github.com/bmc-toolbox/bmclib/v2" bmclib "github.com/bmc-toolbox/bmclib/v2"
@ -33,7 +33,6 @@ const (
HTTPS_PORT = 443 HTTPS_PORT = 443
) )
// NOTE: ...params were getting too long... // NOTE: ...params were getting too long...
type QueryParams struct { type QueryParams struct {
Host string Host string
@ -319,7 +318,6 @@ func CollectInventory(client *bmclib.Client, q *QueryParams) ([]byte, error) {
return nil, fmt.Errorf("could not get inventory: %v", err) return nil, fmt.Errorf("could not get inventory: %v", err)
} }
// retrieve inventory data // retrieve inventory data
data := map[string]any{"Inventory": inventory} data := map[string]any{"Inventory": inventory}
b, err := json.MarshalIndent(data, "", " ") b, err := json.MarshalIndent(data, "", " ")

View file

@ -3,7 +3,7 @@ package sqlite
import ( import (
"fmt" "fmt"
magellan "github.com/OpenChami/magellan/internal" magellan "github.com/OpenCHAMI/magellan/internal"
"github.com/jmoiron/sqlx" "github.com/jmoiron/sqlx"
) )

View file

@ -8,7 +8,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/OpenChami/magellan/internal/util" "github.com/OpenCHAMI/magellan/internal/util"
) )
type ScannedResult struct { type ScannedResult struct {
@ -51,7 +51,6 @@ func rawConnect(host string, ports []int, timeout int, keepOpenOnly bool) []Scan
return results return results
} }
func GenerateHosts(subnet string, subnetMask *net.IP) []string { func GenerateHosts(subnet string, subnetMask *net.IP) []string {
if subnet == "" || subnetMask == nil { if subnet == "" || subnetMask == nil {
return nil return nil

View file

@ -10,15 +10,14 @@ import (
"strings" "strings"
"time" "time"
"github.com/OpenChami/magellan/internal/log" "github.com/OpenCHAMI/magellan/internal/log"
"github.com/OpenChami/magellan/internal/util" "github.com/OpenCHAMI/magellan/internal/util"
bmclib "github.com/bmc-toolbox/bmclib/v2" bmclib "github.com/bmc-toolbox/bmclib/v2"
"github.com/bmc-toolbox/bmclib/v2/constants" "github.com/bmc-toolbox/bmclib/v2/constants"
bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors" bmclibErrs "github.com/bmc-toolbox/bmclib/v2/errors"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
type UpdateParams struct { type UpdateParams struct {
QueryParams QueryParams
FirmwarePath string FirmwarePath string
@ -184,8 +183,6 @@ func GetUpdateStatus(q *UpdateParams) error {
// return fmt.Errorf("could not read file: %v", err) // return fmt.Errorf("could not read file: %v", err)
// } // }
// switch q.TransferProtocol { // switch q.TransferProtocol {
// case "HTTP": // case "HTTP":
// default: // default:

View file

@ -1,7 +1,7 @@
package main package main
import ( import (
"github.com/OpenChami/magellan/cmd" "github.com/OpenCHAMI/magellan/cmd"
) )
func main() { func main() {