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 9f75174 + 8779537 commit ef842a2
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 17 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build image
name: "build image"

on:
push:
Expand All @@ -13,22 +13,42 @@ jobs:
runs-on: ubuntu-latest
environment: default
outputs:
VERSION_KIND: ${{ steps.config_step.outputs.VERSION_KIND }}
VERSION_STR: ${{ steps.config_step.outputs.VERSION_STR }}
ALT_TAGS: ${{ steps.config_step.outputs.ALT_TAGS }}
steps:
- name: "Determine Version"
id: config_step
run: |-
#VER_KIND = 'alpha' (not deployed) | 'dev' | 'beta' | 'gold'
VER_KIND=dev
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}"
VERSION_STR=${VERSION_NUM}
REF_NAME="${{ github.ref_name }}"
if [[ ${REF_NAME} =~ ^(v)([[:digit:]]+\..*)$ ]]; then
VER_KIND=gold
VERSION_STR=${BASH_REMATCH[2]}
else
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 "::notice::Version STR=${VERSION_STR}"
echo "ALT_TAGS=${ALT_TAGS}" >> $GITHUB_OUTPUT
echo "VERSION_KIND=${VER_KIND}" >> $GITHUB_OUTPUT
echo "::notice::Version KIND=${VER_KIND}, STR=${VERSION_STR}${ALT_TAGS}, INT=${VERSION_INT}"
#endjob build_cfg

trigger-build:
Expand Down Expand Up @@ -57,12 +77,12 @@ jobs:
"dockerfile": "Dockerfile",
"arch_allowed": "amd64 arm64",
"name": "${{ github.repository }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}${{ needs.build_cfg.outputs.ALT_TAGS }}",
"build_args": [
]
},
"deployment": {
"deploy_flag": "${{ github.ref_type == 'branch' }}",
"deploy_flag": "${{ needs.build_cfg.outputs.VERSION_KIND == 'dev' }}",
"k8s_project": "${{ env.K8S_PROJECT }}",
"k8s_container": "${{ env.K8S_CONTAINER }}",
"deploy_msg": "${{ env.SLACK_DEPLOY_MSG }}"
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
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:
Expand All @@ -22,13 +24,15 @@ jobs:
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 "::notice::Version STR=${VERSION_STR}"
echo "ALT_TAGS=${ALT_TAGS}" >> $GITHUB_OUTPUT
echo "::notice::Version STR=${VERSION_STR}${ALT_TAGS}"
- name: "Create Release"
uses: softprops/action-gh-release@v1
Expand Down Expand Up @@ -67,7 +71,7 @@ jobs:
"dockerfile": "Dockerfile",
"arch_allowed": "amd64 arm64",
"name": "${{ github.repository }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}",
"tag": "${{ needs.build_cfg.outputs.VERSION_STR }}${{ needs.build_cfg.outputs.ALT_TAGS }}",
"build_args": [
]
},
Expand Down
2 changes: 1 addition & 1 deletion channel_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func sanitizeSecrets(body string) string {
pattern, exists := os.LookupEnv("COURIER_SANITIZE_PATTERN")

if !exists {
pattern = "(?:^Po-Api-Key:.+\\n|^X-Api-Key:.+\\n|^Authorization:.+\\n|^Token:.+\\n)+"
pattern = `(?m)(?:^Po-Api-Key:.+\n|^X-Api-Key:.+\n|^Authorization:.+\n|^Token:.+\n)+`
}

if sanitizeSecretsRegexp == nil {
Expand Down
10 changes: 2 additions & 8 deletions handlers/postmaster/postmaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,7 @@ func (h *handler) SendMsg(ctx context.Context, msg courier.Msg) (courier.MsgStat
return nil, fmt.Errorf("invalid chat mode")
}

deviceId := msg.Channel().ConfigForKey("device_id", "").(string)
if deviceId == "" {
return nil, fmt.Errorf("invalid chat mode")
}
deviceId := msg.Channel().Address()

status := h.Backend().NewMsgStatusForID(msg.Channel(), msg.ID(), courier.MsgErrored)

Expand Down Expand Up @@ -282,10 +279,7 @@ func (h *handler) PurgeOutgoing(ctx context.Context, channel courier.Channel) er
return fmt.Errorf("invalid chat mode")
}

deviceID := channel.ConfigForKey("device_id", "").(string)
if deviceID == "" {
return fmt.Errorf("invalid chat mode")
}
deviceID := channel.Address()

pr := purgeRequest{
DeviceID: deviceID,
Expand Down

0 comments on commit ef842a2

Please sign in to comment.