Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
fix(deps): bump homecentr/base from 2.4.3-alpine to 3.4.2-alpine (#60)
Browse files Browse the repository at this point in the history
* fix(deps): bump homecentr/base from 2.4.3-alpine to 3.4.1-alpine

Bumps homecentr/base from 2.4.3-alpine to 3.4.1-alpine.

---
updated-dependencies:
- dependency-name: homecentr/base
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Package versions

* Test deps

* Test deps

* Test deps

* CI

* CI2

* CI3

* Preserve-env

* Debug

* Deps downgrade

* Debug X

* Debug X+1

* Debug X+2

* Host network

* root

* Debug X+3

* Test fixes

* Test fix 2

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Lukas Holota <[email protected]>
  • Loading branch information
dependabot[bot] and lholota authored Jun 29, 2022
1 parent 1dd1d6e commit 254e659
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 31 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ env:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@master

Expand All @@ -29,14 +32,14 @@ jobs:
- name: Build Docker image
run: docker build . -t ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}

- name: Test Docker image
run: cd tests && sudo gradle test --info -Ddocker_image_tag=${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
- name: Docker version
run: docker --version

- name: Scan with Phonito Security
uses: phonito/phonito-scanner-action@master
with:
image: ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
phonito-token: '${{ secrets.PHONITO_TOKEN }}'
- name: Test Docker image
run: cd tests && gradle test --info -Ddocker_image_tag=${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}
env: # To allow downloading packages
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Scan with Snyk
uses: snyk/actions/[email protected]
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ env:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@master

Expand Down Expand Up @@ -40,14 +43,10 @@ jobs:
- name: Test Docker image
if: env.RELEASE_VERSION != ''
run: cd tests && sudo gradle test -Ddocker_image_tag=${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}

- name: Scan with Phonito Security
if: env.RELEASE_VERSION != ''
uses: phonito/phonito-scanner-action@master
with:
image: ${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
phonito-token: '${{ secrets.PHONITO_TOKEN }}'
run: cd tests && sudo --preserve-env gradle test -Ddocker_image_tag=${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
env: # To allow downloading packages
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Scan with Snyk
if: env.RELEASE_VERSION != ''
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM homecentr/base:2.4.3-alpine
FROM homecentr/base:3.4.2-alpine

ENV DHCP_ARGS=""

RUN apk add --no-cache \
dhcp=4.4.2-r1 \
libcap=2.27-r0 && \
dhcp=4.4.3-r0 \
libcap=2.64-r0 && \
rm /etc/dhcp/dhcpd.conf.example && \
mkdir /leases && \
chmod 0777 /leases && \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ networks:
ipam:
driver: default
config:
- subnet: "172.18.250.0/24"
- subnet: "172.19.250.0/24"
6 changes: 3 additions & 3 deletions example/dhcpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ authoritative;

option client-arch code 93 = unsigned integer 16;

subnet 172.18.250.0 netmask 255.255.255.0 {
range 172.18.250.50 172.18.250.60;
option routers 172.18.250.1;
subnet 172.19.250.0 netmask 255.255.255.0 {
range 172.19.250.50 172.19.250.60;
option routers 172.19.250.1;
}
2 changes: 1 addition & 1 deletion tests/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@ sourceCompatibility = 1.8
repositories {
mavenCentral()
maven {
url "https://dl.bintray.com/homecentr/maven"
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/homecentr/testcontainers-extensions")
credentials {
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
}
}
}

dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.13'
testImplementation 'org.testcontainers:testcontainers:1.14.3'
testImplementation 'io.homecentr:testcontainers-extensions:1.4.0'
testImplementation group: 'org.testcontainers', name: 'testcontainers', version: '1.16.0'
testImplementation group: 'io.homecentr', name: 'testcontainers-extensions', version: '1.6.0'
testImplementation group: 'commons-net', name: 'commons-net', version: '3.6'
testImplementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
Expand Down
31 changes: 27 additions & 4 deletions tests/src/test/java/DhcpContainerShould.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,24 @@ public class DhcpContainerShould {

@BeforeClass
public static void setUp() throws IOException {
Network network = Network.builder().build();
Network network = Network.builder()
.driver("bridge")
.build();

DhcpdConfig config = DhcpdConfig.createFromNetwork(network);

_serverContainer = new GenericContainerEx<>(new DockerImageTagResolver())
.withNetwork(network)
.withNetworkAliases("dhcp-server.docker")
//.withEnv("PUID", "0")
//.withEnv("PGID", "0")
.withFileSystemBind(config.getAbsolutePath(), "/config/dhcpd.conf")
.waitingFor(WaitEx.forLogMessage("(.*)Socket/fallback/fallback-net(.*)", 1));
.waitingFor(WaitEx.forLogMessage("(.*)fallback-net(.*)", 1));

_clientContainer = new GenericContainerEx<>(HelperImages.DhcpClient())
.withCommand("sleep", "1000h")
//.withEnv("PUID", "0")
//.withEnv("PGID", "0")
.withNetwork(network);

_serverContainer.start();
Expand All @@ -53,9 +61,24 @@ public static void cleanUp() {

@Test
public void respondToDhcpDiscovery() throws IOException, InterruptedException {
Container.ExecResult result = _clientContainer.executeShellCommand("nmap --script broadcast-dhcp-discover");
int retryCounter = 0;
int retryLimit = 10;
Container.ExecResult result = null;

while(retryCounter < retryLimit) {
System.out.println("Attempting DHCP discovery...");

result = _clientContainer.executeShellCommand("nmap -p 67 --script broadcast-dhcp-discover");

if(result.getStdout().contains("IP Offered:")){
break;
}

retryCounter++;

Thread.sleep(2000);
}

assertEquals(0, result.getExitCode());
assertTrue(result.getStdout().contains("IP Offered:"));
}
}

0 comments on commit 254e659

Please sign in to comment.