Skip to content

Commit

Permalink
Ensure curl and wget are installed in images
Browse files Browse the repository at this point in the history
  • Loading branch information
emerkle826 committed Oct 13, 2023
1 parent ef42f52 commit 176b243
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
cassandra-version: ['3.11', '4.0', '4.1', '3.11_ubi', '4.0_ubi', '4.1_ubi']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'NonDestructiveOpsResourcesV2IT']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'NonDestructiveOpsResourcesV2IT', 'DockerImageIT']
include:
- cassandra-version: '3.11'
run311tests: true
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
fail-fast: false
matrix:
platform-version: ['jdk8', 'ubi']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'DSESpecificIT', 'NonDestructiveOpsResourcesV2IT']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'DSESpecificIT', 'NonDestructiveOpsResourcesV2IT', 'DockerImageIT']
include:
- platform-version: 'jdk8'
runDSEtests: true
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Changelog for Management API, new PRs should update the `main / unreleased` sect
```

## unreleased
* [CHANGE] [#400](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/400) Ensure curl and wget are installed in images
* [FEATURE] [#326](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/326) Provide topology endpoints in OpenAPI client
* [FEATURE] [#345](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/345) Implement host related methods
* [FEATURE] [#361](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/361) Add new listTables operation with more detailed response
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-4_0.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ENV CASSANDRA_DATA_DIR /var/lib/cassandra
# Update base layer
RUN microdnf update && rm -rf /var/cache/yum \
# Install packages needed during install process
&& microdnf install --nodocs java-11-openjdk-headless tzdata-java python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en \
&& microdnf install --nodocs java-11-openjdk-headless tzdata-java python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en wget \
&& microdnf clean all \
# Add Cassandra user
&& groupadd -r cassandra --gid=999 \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-4_1.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ENV CASSANDRA_DATA_DIR /var/lib/cassandra
# Update base layer
RUN microdnf update && rm -rf /var/cache/yum \
# Install packages needed during install process
&& microdnf install --nodocs java-11-openjdk-headless tzdata-java python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en \
&& microdnf install --nodocs java-11-openjdk-headless tzdata-java python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en wget \
&& microdnf clean all \
# Add Cassandra user
&& groupadd -r cassandra --gid=999 \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-oss.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ENV CASSANDRA_DATA_DIR /var/lib/cassandra
# Update base layer
RUN microdnf update && rm -rf /var/cache/yum \
# Install packages needed during install process
&& microdnf install --nodocs java-1.8.0-openjdk-headless python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en \
&& microdnf install --nodocs java-1.8.0-openjdk-headless python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en wget \
&& microdnf clean all \
# Add Cassandra user
&& groupadd -r cassandra --gid=999 \
Expand Down
2 changes: 1 addition & 1 deletion cassandra-trunk/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ENV CASSANDRA_FILES_PATH /opt/cassandra_files
# Update base layer
RUN microdnf update && rm -rf /var/cache/yum \
# Install packages needed during install process
&& microdnf install --nodocs java-11-openjdk-headless tzdata-java python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en \
&& microdnf install --nodocs java-11-openjdk-headless tzdata-java python3 zlib findutils which hostname iproute shadow-utils procps util-linux glibc-langpack-en wget \
&& microdnf clean all \
# Add Cassandra user
&& groupadd -r cassandra --gid=999 \
Expand Down
2 changes: 1 addition & 1 deletion dse-68/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

# Install runtime dependencies and updates
RUN microdnf update && rm -rf /var/cache/yum && \
microdnf install --nodocs -y java-1.8.0-openjdk-headless java-1.8.0-openjdk-devel python2 zlib libaio which findutils hostname iproute shadow-utils procps util-linux glibc-langpack-en && microdnf clean all
microdnf install --nodocs -y java-1.8.0-openjdk-headless java-1.8.0-openjdk-devel python2 zlib libaio which findutils hostname iproute shadow-utils procps util-linux glibc-langpack-en wget && microdnf clean all

WORKDIR $HOME

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright DataStax, Inc.
*
* Please see the included license file for details.
*/
package com.datastax.mgmtapi;

import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;

import com.datastax.mgmtapi.helpers.IntegrationTestUtils;
import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

@RunWith(Parameterized.class)
public class DockerImageIT extends BaseDockerIntegrationTest {

public DockerImageIT(String version) throws IOException {
super(version);
}

@Test
public void testCurlExists() {
assumeTrue(IntegrationTestUtils.shouldRun());
// see if curl is installed
try {
testCommandExists("curl");
} catch (Throwable t) {
// this is expected, ensure the message indicates a process error code
fail(
"\"curl\" was not found in the image. Please ensure it has been added to the Dockerfile");
}
}

@Test
public void testWgetExists() {
assumeTrue(IntegrationTestUtils.shouldRun());
// ensure wget is installed
try {
testCommandExists("wget");
} catch (Throwable t) {
fail(
"\"wget\" was not found in the image. Please ensure it has been added to the Dockerfile");
}
}

private void testCommandExists(String cmd) {
String execId = docker.runCommand("which", "wget");
docker.waitTillFinished(execId);
}
}

0 comments on commit 176b243

Please sign in to comment.