Skip to content

Commit 283f18a

Browse files
committed
update so that project can run on latest crictl version
1 parent c315d2d commit 283f18a

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
lines changed

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM registry.access.redhat.com/ubi7/ubi as rhel7builder
1+
FROM registry.access.redhat.com/ubi7/ubi AS rhel7builder
2+
3+
ARG CRICTL_VERSION=1.33.0
24

35
RUN yum install -y gcc openssl-devel && \
46
rm -rf /var/cache/dnf && \
@@ -12,7 +14,7 @@ ENV PATH=/root/.cargo/bin:${PATH}
1214

1315
RUN cargo build --release -p core-dump-composer
1416

15-
FROM registry.access.redhat.com/ubi8/ubi as rhel8builder
17+
FROM registry.access.redhat.com/ubi8/ubi AS rhel8builder
1618

1719
RUN yum install -y gcc openssl-devel && \
1820
rm -rf /var/cache/dnf && \
@@ -26,8 +28,8 @@ ENV PATH=/root/.cargo/bin:${PATH}
2628

2729
RUN cargo build --release
2830

29-
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.22.0/crictl-v1.22.0-linux-amd64.tar.gz --output crictl-v1.22.0-linux-amd64.tar.gz
30-
RUN tar zxvf crictl-v1.22.0-linux-amd64.tar.gz
31+
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v${CRICTL_VERSION}/crictl-v${CRICTL_VERSION}-linux-amd64.tar.gz --output crictl-v${CRICTL_VERSION}-linux-amd64.tar.gz
32+
RUN tar zxvf crictl-v${CRICTL_VERSION}-linux-amd64.tar.gz
3133

3234
FROM registry.access.redhat.com/ubi8/ubi-minimal
3335

core-dump-agent/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
extern crate dotenv;
22
extern crate s3;
33

4-
use advisory_lock::{AdvisoryFileLock, FileLockMode};
54
use env_logger::Env;
65
use inotify::{EventMask, Inotify, WatchMask};
76
use log::{error, info, warn};
@@ -292,7 +291,7 @@ async fn process_file(zip_path: &Path, bucket: &Bucket) {
292291

293292
let f = File::open(zip_path).expect("no file found");
294293

295-
match f.try_lock(FileLockMode::Shared) {
294+
match f.try_lock_shared() {
296295
Ok(_) => { /* If we can lock then we are ok */ }
297296
Err(e) => {
298297
let l_inotify = env::var("USE_INOTIFY")

core-dump-composer/src/events.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::config::CoreParams;
2-
use advisory_lock::{AdvisoryFileLock, FileLockMode};
32
use serde::Serialize;
43
use serde_json::Value;
54
use std::collections::HashMap;
@@ -87,7 +86,7 @@ impl CoreEvent {
8786
pub fn write_event(&self, eventlocation: &str) -> Result<(), anyhow::Error> {
8887
let full_path = format!("{}/{}-event.json", eventlocation, self.uuid);
8988
let file = File::create(full_path)?;
90-
file.lock(FileLockMode::Exclusive)?;
89+
file.lock_shared()?;
9190
serde_json::to_writer(&file, &self)?;
9291
file.unlock()?;
9392
Ok(())

core-dump-composer/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ extern crate dotenv;
22

33
use crate::events::CoreEvent;
44

5-
use advisory_lock::{AdvisoryFileLock, FileLockMode};
65
use libcrio::Cli;
76
use log::{debug, error, info, warn};
87
use serde_json::json;
@@ -131,7 +130,7 @@ fn handle(mut cc: config::CoreConfig) -> Result<(), anyhow::Error> {
131130
process::exit(1);
132131
}
133132
};
134-
file.lock(FileLockMode::Exclusive)?;
133+
file.lock_shared()?;
135134
let mut zip = ZipWriter::new(&file);
136135

137136
debug!(

musl.Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM docker.io/alpine:3.15.4 as builder
2-
1+
FROM docker.io/alpine:3.23.3 AS builder
32
ARG ARCH
3+
ARG CRICTL_VERSION=1.33.0
44

5-
RUN apk update && apk add curl binutils build-base
5+
RUN apk update && apk add curl binutils build-base openssl-dev openssl-libs-static
66

77
RUN if [ $ARCH == "amd64" ]; then curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable-x86_64-unknown-linux-musl -y; fi
88

9-
RUN if [ $ARCH == "arm64" ]; then curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.61.0-aarch64-unknown-linux-musl -y; fi
9+
RUN if [ $ARCH == "arm64" ]; then curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable-aarch64-unknown-linux-musl -y; fi
1010

1111
RUN ls -a /root/.cargo/bin
1212

@@ -17,10 +17,10 @@ WORKDIR "/app-build"
1717
ENV PATH=/root/.cargo/bin:${PATH}
1818
RUN cargo build --verbose --release
1919

20-
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v1.22.0/crictl-v1.22.0-linux-$ARCH.tar.gz --output crictl-v1.22.0-linux-$ARCH.tar.gz
21-
RUN tar zxvf crictl-v1.22.0-linux-$ARCH.tar.gz
20+
RUN curl -L https://github.com/kubernetes-sigs/cri-tools/releases/download/v${CRICTL_VERSION}/crictl-v${CRICTL_VERSION}-linux-$ARCH.tar.gz --output crictl-v${CRICTL_VERSION}-linux-$ARCH.tar.gz
21+
RUN tar zxvf crictl-v${CRICTL_VERSION}-linux-$ARCH.tar.gz
2222

23-
FROM docker.io/alpine:3.15.4
23+
FROM docker.io/alpine:3.23.3
2424

2525
RUN apk update && apk add procps
2626

@@ -32,4 +32,4 @@ RUN mv core-dump-composer cdc
3232

3333
WORKDIR "/app"
3434
COPY --from=builder /app-build/crictl ./
35-
CMD ["./core-dump-agent"]
35+
CMD ["./core-dump-agent"]

0 commit comments

Comments
 (0)