Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
selimseker committed Nov 5, 2024
1 parent f8feffa commit d31d811
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 44 deletions.
22 changes: 7 additions & 15 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
name: Build and Publish Launch Releases

on:
release:
types: [published]
push:
branches:
- test

jobs:

check_release:
if: "! contains(github.event.release.tag_name, '-dev')" # skip if the tag ends with -dev
runs-on: ubuntu-latest
steps:
- name: Echo tag
run: |
echo "tag name: ${{ github.event.release.tag_name }}"
echo "release name: ${{ github.event.release.name }}"
build:
runs-on: ${{ matrix.runner }}

Expand Down Expand Up @@ -42,7 +34,7 @@ jobs:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.arch }}
run: |
${{ matrix.env }} go build -ldflags="-X main.version=${{ github.event.release.tag_name }}" -tags="${{ matrix.tags }}" -o dkn-compute-launcher${{ matrix.extension }} .
${{ matrix.env }} go build -ldflags="-X main.version=v0.1.14" -tags="${{ matrix.tags }}" -o dkn-compute-launcher${{ matrix.extension }} .
- name: Prepare Launch Release Files
env:
Expand Down Expand Up @@ -84,9 +76,9 @@ jobs:
- name: Create release with artifacts
uses: ncipollo/release-action@v1
with:
name: ${{ github.event.release.name }}
tag: ${{ github.event.release.tag_name }}
name: test
tag: v0.1.14
artifacts: "artifacts/*"
artifactContentType: application/zip
allowUpdates: true
# draft: true
draft: true
60 changes: 31 additions & 29 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func main() {
trace := flag.Bool("trace", false, "Sets the logging level to trace (default: false)")
dkn_admin_pkey_flag := flag.String("dkn-admin-public-key", DKN_ADMIN_PUBLIC_KEY, "DKN Admin Node Public Key, usually dont need this since it's given by default")
pick_model := flag.Bool("pick-models", false, "Pick the models using cli, supprases the -m flags (default: false)")
use_compute_dev_version := flag.Bool("compute-dev-version", false, "For using the latest dev version of dkn-compute node (optional, only for development purposes)")
// use_compute_dev_version := flag.Bool("compute-dev-version", false, "For using the latest dev version of dkn-compute node (optional, only for development purposes)")
flag.Parse()

// Display help and exit if -h or --help is provided
Expand Down Expand Up @@ -212,35 +212,35 @@ func main() {
}

// get latest dkn_compute binary version
computeVersion, err := utils.GetComputeVersionTag(!(*use_compute_dev_version), *use_compute_dev_version, false)
if err != nil {
fmt.Println("Couldn't get the latest dkn-compute version")
utils.ExitWithDelay(1)
}
// computeVersion, err := utils.GetComputeVersionTag(!(*use_compute_dev_version), *use_compute_dev_version, false)
// if err != nil {
// fmt.Println("Couldn't get the latest dkn-compute version")
// utils.ExitWithDelay(1)
// }
dkn_compute_binary := utils.ComputeBinaryFileName()

// check dkn-compute binary has already installed
if utils.FileExists(utils.ComputeBinaryFileName()) {
// compare current and latest versions
if computeVersion != envvars["DKN_COMPUTE_VERSION"] {
fmt.Printf("New dkn-compute version detected (%s), downloading it...\n", computeVersion)
if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil {
fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err)
utils.ExitWithDelay(1)
}
envvars["DKN_COMPUTE_VERSION"] = computeVersion
} else {
fmt.Printf("Current version is up to date (%s)\n", envvars["DKN_COMPUTE_VERSION"])
}
} else {
// couldn't find the dkn-compute binary, download it
fmt.Printf("Downloading the latest dkn-compute binary (%s)\n", computeVersion)
if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil {
fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err)
utils.ExitWithDelay(1)
}
envvars["DKN_COMPUTE_VERSION"] = computeVersion
}
// if utils.FileExists(utils.ComputeBinaryFileName()) {
// // compare current and latest versions
// if computeVersion != envvars["DKN_COMPUTE_VERSION"] {
// fmt.Printf("New dkn-compute version detected (%s), downloading it...\n", computeVersion)
// if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil {
// fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err)
// utils.ExitWithDelay(1)
// }
// envvars["DKN_COMPUTE_VERSION"] = computeVersion
// } else {
// fmt.Printf("Current version is up to date (%s)\n", envvars["DKN_COMPUTE_VERSION"])
// }
// } else {
// // couldn't find the dkn-compute binary, download it
// fmt.Printf("Downloading the latest dkn-compute binary (%s)\n", computeVersion)
// if err := utils.DownloadLatestComputeBinary(computeVersion, working_dir, dkn_compute_binary, true); err != nil {
// fmt.Printf("Error during downloading the latest dkn-compute binary %s\n", err)
// utils.ExitWithDelay(1)
// }
// envvars["DKN_COMPUTE_VERSION"] = computeVersion
// }

// dump the final env
utils.RemoveEmptyEnvVars(&envvars)
Expand Down Expand Up @@ -324,10 +324,12 @@ func main() {

// new version check loop
for {
time.Sleep(60 * time.Minute)
time.Sleep(30 * time.Second)
logger.Printf("Checking the new version...")
// Check if a new version is available
newVersionAvailable, newVersion := utils.IsNewVersionAvaliable(envvars["DKN_COMPUTE_VERSION"])
// newVersionAvailable, newVersion := utils.IsNewVersionAvaliable(envvars["DKN_COMPUTE_VERSION"])
newVersionAvailable := true
newVersion := "v0.2.18"
if newVersionAvailable {
logger.Printf("A new compute-node version detected, downloading the new version...")
newBinaryTempName := fmt.Sprintf("temp-%s", dkn_compute_binary)
Expand Down

0 comments on commit d31d811

Please sign in to comment.