Skip to content

Commit

Permalink
fix: manage nightly/release tags differently
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 committed Oct 14, 2024
1 parent 1dd1d8f commit 36aabf1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,34 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern=${{ env.TAG }}
type=raw,value=latest-{{date 'YYYYMMDDHHmmss'}}-{{sha}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
if: ${{needs.release-please.outputs.release_created == 'true'}}
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
platforms: |
linux/amd64
linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Extract metadata (tags, labels) for Docker
id: meta
if: ${{ needs.release-please.outputs.release_created != 'true' }}
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest-{{date 'YYYYMMDDHHmmss'}}-{{sha}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
if: ${{ needs.release-please.outputs.release_created != 'true' }}
with:
context: .
file: ./Dockerfile
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ func main() {
defer cancel()

config := MustParseConfig()
queries := mustParseQueryFile(config.QueriesFile)
queries := MustParseQueryFile(config.QueriesFile)
promController := NewPrometheusController(config.Prometheus.String(), queries)

router := NewRouter(promController)

log.Ctx(ctx).Info().Strs("queries", slices.Collect(maps.Keys(queries))).Msg("Found queries")
log.Ctx(ctx).Info().Strs("found queries", slices.Collect(maps.Keys(queries))).Send()
log.Ctx(ctx).Info().Msgf("Starting server on http://localhost:%d/query/{query}", config.Port)
err := Serve(ctx, config.Port, router)
log.Err(err).Msg("Terminated")
}

func mustParseQueryFile(queriesFile string) map[string]string {
func MustParseQueryFile(queriesFile string) map[string]string {
queries := map[string]string{}
content, err := os.ReadFile(queriesFile)
if err != nil {
Expand Down

0 comments on commit 36aabf1

Please sign in to comment.