Skip to content

Commit

Permalink
Merge pull request #49 from philipcristiano/rust-workflow
Browse files Browse the repository at this point in the history
chore: Update rust workflow
  • Loading branch information
philipcristiano authored Dec 6, 2023
2 parents f686410 + 414d02e commit f0726b2
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 12 deletions.
24 changes: 23 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
Expand All @@ -12,11 +14,31 @@ updates:
opentelemetry:
patterns:
- "*opentelemetry*"
dependencies:
patch-dependencies:
patterns:
- "*"
exclude-patterns:
- "*opentelemetry*"
update-types:
- "patch"
minor-dependencies:
patterns:
- "*"
exclude-patterns:
- "*opentelemetry*"
update-types:
- "minor"
- "patch"
major-dependencies:
patterns:
- "*"
exclude-patterns:
- "*opentelemetry*"
update-types:
- "minor"
- "patch"
- "major"

- package-ecosystem: "docker" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
with:
automerge: true

check-for-cc:
runs-on: ubuntu-latest
steps:
- name: check-for-cc
id: check-for-cc
uses: agenthunt/[email protected]

docker_build:
uses: "philipcristiano/workflows/.github/workflows/docker-build.yml@main"
with:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/push_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ on:
push:
branches:
- main
tags:
- "*"

permissions:
pull-requests: write
contents: write

jobs:

docker_push:
name: "Push docker image"
uses: "philipcristiano/workflows/.github/workflows/docker-build-push.yml@main"

needs: [flake, rust]
with:
repository: philipcristiano/nomad-events-logger
repository: ${{ github.repository }}
timeout: 25

secrets:
Expand All @@ -24,6 +26,13 @@ jobs:
rust:
uses: "philipcristiano/workflows/.github/workflows/rust.yml@main"

rust_release:
uses: "philipcristiano/workflows/.github/workflows/rust_release.yml@main"
needs: [flake, rust]
secrets:
WF_GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

flake:
uses: "philipcristiano/workflows/.github/workflows/nix.yml@main"
with:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# release-plz creates the release/tag which won't trigger again for the commit for `push_main`
name: Docker Release

on:
release:
types: [published]
push:
tags:
- "*"

jobs:

docker_push:
name: "Push docker image"
uses: "philipcristiano/workflows/.github/workflows/docker-build-push.yml@main"
with:
repository: ${{ github.repository }}
timeout: 25

secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[package]
name = "nomad-events-logger"
name = "nomad_events_logger"
version = "0.1.3"
edition = "2021"
description = "Log events from the Nomad API"
license = "Apache-2.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bytes = "1.5.0"
clap = { version = "4.4.10", features = ["derive"] }
clap = { version = "4.4.6", features = ["derive"] }
nomad-client-rs = "0.9.1"
serde_json = "1.0.108"
serde_json = "1.0.107"
tokio = { version = "1", features = ["full"] }
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ RUN cargo install --path .

FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y procps && rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/nomad-events-logger /usr/local/bin/nomad-events-logger
CMD ["nomad-events-logger"]
COPY --from=builder /usr/local/cargo/bin/nomad_events_logger /usr/local/bin/nomad_events_logger
CMD ["nomad_events_logger"]
4 changes: 2 additions & 2 deletions example-nomad-job.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ job "nomad-events-logger" {
type = "script"
task = "app"

command = "/usr/local/bin/nomad-events-logger"
command = "/usr/local/bin/nomad_events_logger"
args = ["-V"]

interval = "30s"
Expand All @@ -57,7 +57,7 @@ job "nomad-events-logger" {

config {
image = var.image_id
command = "nomad-events-logger"
command = "nomad_events_logger"
}

template {
Expand Down

0 comments on commit f0726b2

Please sign in to comment.