Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
baracudda committed Apr 24, 2024
2 parents 3560fc7 + 953880e commit 9f87f12
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 87 deletions.
38 changes: 32 additions & 6 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,41 @@ jobs:
environment: default
outputs:
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }}
ALT_TAGS: ${{ steps.config_step.outputs.ALT_TAGS }}
steps:
- uses: actions/checkout@v3

- name: "Determine Version"
id: config_step
run: |-
VERSION_STR=$(cat VERSION)
echo "::notice::Version STR=${VERSION_STR}"
#VER_KIND = 'alpha' (not deployed) | 'dev' | 'beta' | 'gold'
VER_KIND=alpha
VER_BUILD=$(date +%H%M)
# limit to only first 3 chars
VER_BUILD=${VER_BUILD:0:3}
# 'strict' semver segments cannot start with 0
VERSION_NUM="$(date +%y).$(date +%-m).$(date +%-d).${VER_BUILD#0}"
echo "VERSION_NUM=${VERSION_NUM}" >> $GITHUB_OUTPUT
# recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int.
VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}"
echo "VERSION_INT=${VERSION_INT}" >> $GITHUB_OUTPUT
REF_NAME="${{ github.ref_name }}"
if [[ ${REF_NAME} =~ ^(v)([[:digit:]]+\..*)$ ]]; then
VER_KIND=gold
VERSION_STR=${BASH_REMATCH[2]}
else
VERSION_STR=ci-${VERSION_NUM}
ALT_TAGS=""
if [[ "${REF_NAME}" == "develop" ]]; then
ALT_TAGS+=",ci-develop"
else
ALT_TAGS=",ci-dev-${REF_NAME#**/}"
fi
fi
echo "VERSION_STR=${VERSION_STR}" >> $GITHUB_OUTPUT
echo "ALT_TAGS=${ALT_TAGS}" >> $GITHUB_OUTPUT
echo "::notice::Version KIND=${VER_KIND}, STR=${VERSION_STR}${ALT_TAGS}, INT=${VERSION_INT}"
#endjob build_cfg

trigger-build:
Expand All @@ -35,7 +61,7 @@ jobs:
SLACK_DEPLOY_MSG:
steps:
- name: "Trigger Container Build"
uses: peter-evans/repository-dispatch@v2
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.CI_WEBHOOK_TOKEN }}
repository: istresearch/ci-docker
Expand All @@ -51,7 +77,7 @@ jobs:
"dockerfile": "Dockerfile",
"arch_allowed": "amd64 arm64",
"name": "${{ github.repository }}",
"version": "${{ needs.build_cfg.outputs.VERSION_STR }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}${{ needs.build_cfg.outputs.ALT_TAGS }}",
"build_args": [
]
},
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Tag Release"

on:
push:
branches:
- main
- master

jobs:
build_cfg:
runs-on: ubuntu-latest
outputs:
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }}
VERSION_INT: ${{ steps.config_step.outputs.VERSION_INT }}
ALT_TAGS: ${{ steps.config_step.outputs.ALT_TAGS }}
permissions:
contents: write
steps:
- name: "Create Version STR"
id: config_step
run: |-
VER_BUILD=$(date +%H%M)
# limit to only first 3 chars
VER_BUILD=${VER_BUILD:0:3}
# 'strict' semver segments cannot start with 0
VERSION_NUM="$(date +%y).$(date +%-m).$(date +%-d).${VER_BUILD#0}"
# recreate as INT, leaving 0's in place; creates a 'reasonable' 32-bit signed int.
VERSION_INT="$(date +%y)$(date +%m)$(date +%d)${VER_BUILD}"
echo "VERSION_INT=${VERSION_INT}" >> $GITHUB_OUTPUT
VERSION_STR=${VERSION_NUM}
ALT_TAGS=",ci-main"
echo "VERSION_STR=${VERSION_STR}" >> $GITHUB_OUTPUT
echo "ALT_TAGS=${ALT_TAGS}" >> $GITHUB_OUTPUT
echo "::notice::Version STR=${VERSION_STR}${ALT_TAGS}"
- name: "Create Release"
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.config_step.outputs.VERSION_STR }}
release_name: v${{ steps.config_step.outputs.VERSION_STR }}
generate_release_notes: true
target_commitish: ${{ github.ref_name }}
#endjob build_cfg

trigger-build:
runs-on: ubuntu-latest
needs: [build_cfg]
environment: default
env:
K8S_PROJECT: pulse-engage-mailroom
K8S_CONTAINER: mailroom
SLACK_DEPLOY_MSG:
steps:
- name: "Trigger Container Build"
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.CI_WEBHOOK_TOKEN }}
repository: istresearch/ci-docker
event-type: build-repo
client-payload: |-
{
"repo": {
"name": "${{ github.repository }}",
"ref_type": "${{ github.ref_type }}",
"ref_name": "${{ github.ref_name }}"
},
"image": {
"dockerfile": "Dockerfile",
"arch_allowed": "amd64 arm64",
"name": "${{ github.repository }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}${{ needs.build_cfg.outputs.ALT_TAGS }}",
"build_args": [
]
},
"callback": {
"repository": "${{ github.repository }}",
"event_type": "build_image_result",
"error_type": "build_image_error"
}
}
#endjob trigger-build
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

3 changes: 3 additions & 0 deletions cmd/mailroom/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import (
"math/rand"
"os"
"os/signal"
goruntime "runtime"
"syscall"
"time"

"github.com/nyaruka/ezconf"
"github.com/nyaruka/gocommon/uuids"
Expand Down Expand Up @@ -65,6 +67,7 @@ func (u UTCLogFormatter) Format(e *logrus.Entry) ([]byte, error) {
}

func main() {
rand.Seed(time.Now().Unix()) // initialize global pseudo random generator prior to GoLang 1.20
config := runtime.NewDefaultConfig()
config.Version = version
loader := ezconf.NewLoader(
Expand Down
3 changes: 3 additions & 0 deletions core/models/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,9 @@ func (b *BroadcastBatch) CreateMessages(ctx context.Context, rt *runtime.Runtime
break
}
}
} else if false {
//<*((==<
//TODO
} else {
// no forced URN, find the first URN we can send to
for _, u := range contact.URNs() {
Expand Down
50 changes: 25 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module github.com/nyaruka/mailroom

go 1.18
go 1.19

require (
github.com/Masterminds/semver v1.5.0
github.com/aws/aws-sdk-go v1.44.44
github.com/aws/aws-sdk-go v1.51.28
github.com/buger/jsonparser v1.1.1
github.com/edganiukov/fcm v0.4.0
github.com/go-chi/chi v4.1.2+incompatible
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/golang/protobuf v1.5.2
github.com/gomodule/redigo v1.8.8
github.com/gorilla/schema v1.2.0
github.com/jmoiron/sqlx v1.3.5
github.com/lib/pq v1.10.6
github.com/golang/protobuf v1.5.4
github.com/gomodule/redigo v1.9.2
github.com/gorilla/schema v1.3.0
github.com/jmoiron/sqlx v1.4.0
github.com/lib/pq v1.10.9
github.com/nyaruka/ezconf v0.2.1
github.com/nyaruka/gocommon v1.22.4
github.com/nyaruka/goflow v0.163.0
Expand All @@ -25,43 +25,43 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.35.0
github.com/shopspring/decimal v1.3.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.8.0
github.com/shopspring/decimal v1.4.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
gopkg.in/go-playground/validator.v9 v9.31.0
)

require (
github.com/Shopify/gomail v0.0.0-20220314142144-6897a5a5ba29 // indirect
github.com/Shopify/gomail v0.0.0-20220729171026-0784ece65e69 // indirect
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20220527190237-ee62e23da966 // indirect
github.com/blevesearch/segment v0.9.0 // indirect
github.com/blevesearch/segment v0.9.1 // indirect
github.com/certifi/gocertifi v0.0.0-20210507211836-431795d63e8d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/getsentry/raven-go v0.1.2-0.20190125112653-238ebd86338d // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/naoina/toml v0.1.1 // indirect
github.com/nyaruka/librato v1.0.0 // indirect
github.com/nyaruka/phonenumbers v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
golang.org/x/exp v0.0.0-20220613132600-b0d781184e0d // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/nyaruka/goflow v0.163.0 => github.com/istresearch/goflow v0.2401.9-190
replace github.com/nyaruka/goflow v0.163.0 => github.com/istresearch/goflow v0.2403.27-205
Loading

0 comments on commit 9f87f12

Please sign in to comment.