Skip to content

Commit 93a3784

Browse files
authored
Merge pull request #296 from netbox-community/develop
Release 0.24.0
2 parents 5769684 + 45f7823 commit 93a3784

17 files changed

+246
-149
lines changed

.github/no-response.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Configuration for probot-no-response - https://github.com/probot/no-response
2+
3+
# Number of days of inactivity before an Issue is closed for lack of response
4+
daysUntilClose: 30
5+
# Label requiring a response
6+
responseRequiredLabel: awaiting answer
7+
# Comment to post when closing an Issue for lack of response. Set to `false` to disable
8+
closeComment: >
9+
This issue has been automatically closed because there has been no response
10+
to our request for more information from the original author.

.github/workflows/push.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
build_cmd:
1616
- ./build-latest.sh
1717
- PRERELEASE=true ./build-latest.sh
18-
- ./build-branches.sh
18+
- ./build-next.sh
19+
- ./build.sh develop
1920
docker_from:
2021
- '' # use the default of the DOCKERFILE
2122
- python:3.7-alpine

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ jobs:
1414
build_cmd:
1515
- ./build-latest.sh
1616
- PRERELEASE=true ./build-latest.sh
17-
- ./build-branches.sh
17+
- ./build-next.sh
18+
- ./build.sh develop
1819
fail-fast: false
1920
runs-on: ubuntu-latest
2021
name: Builds new Netbox Docker Images
2122
steps:
2223
- id: git-checkout
2324
name: Checkout
24-
uses: actions/checkout@v1
25+
uses: actions/checkout@v2
2526
- id: docker-build
2627
name: Build the image with '${{ matrix.build_cmd }}'
2728
run: ${{ matrix.build_cmd }}

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG FROM=python:3.7-alpine
1+
ARG FROM
22
FROM ${FROM} as builder
33

44
RUN apk add --no-cache \
@@ -75,7 +75,7 @@ WORKDIR /opt/netbox/netbox
7575
# container startup.
7676
# Must set permissions for '/opt/netbox/netbox/media' directory
7777
# to g+w so that pictures can be uploaded to netbox.
78-
RUN mkdir static && chmod g+w static media
78+
RUN mkdir static && chmod -R g+w static media
7979

8080
ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
8181

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ There is a more complete [_Getting Started_ guide on our wiki][wiki-getting-star
5252
```bash
5353
git clone -b release https://github.com/netbox-community/netbox-docker.git
5454
cd netbox-docker
55-
tee netbox-docker.override.yml <<EOF
55+
tee docker-compose.override.yml <<EOF
5656
version: '3.4'
5757
services:
5858
nginx:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.23.0
1+
0.24.0

build-all.sh

Lines changed: 0 additions & 51 deletions
This file was deleted.

build-functions/docker-functions.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
push_image_to_registry() {
4+
local target_tag=$1
5+
echo "⏫ Pushing '${target_tag}'"
6+
$DRY docker push "${target_tag}"
7+
echo "✅ Finished pushing the Docker image '${target_tag}'."
8+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash
2+
# Retrieves image configuration from public images in DockerHub
3+
# Functions from https://gist.github.com/cirocosta/17ea17be7ac11594cb0f290b0a3ac0d1
4+
# Optimised for our use case
5+
6+
get_image_label() {
7+
local label=$1
8+
local image=$2
9+
local tag=$3
10+
local token
11+
token=$(_get_token "$image")
12+
local digest
13+
digest=$(_get_digest "$image" "$tag" "$token")
14+
local retval="null"
15+
if [ "$digest" != "null" ]; then
16+
retval=$(_get_image_configuration "$image" "$token" "$digest" "$label")
17+
fi
18+
echo "$retval"
19+
}
20+
21+
get_image_layers() {
22+
local image=$1
23+
local tag=$2
24+
local token
25+
token=$(_get_token "$image")
26+
_get_layers "$image" "$tag" "$token"
27+
}
28+
29+
get_image_last_layer() {
30+
local image=$1
31+
local tag=$2
32+
local token
33+
token=$(_get_token "$image")
34+
local layers
35+
mapfile -t layers < <(_get_layers "$image" "$tag" "$token")
36+
echo "${layers[-1]}"
37+
}
38+
39+
_get_image_configuration() {
40+
local image=$1
41+
local token=$2
42+
local digest=$3
43+
local label=$4
44+
curl \
45+
--silent \
46+
--location \
47+
--header "Authorization: Bearer $token" \
48+
"https://registry-1.docker.io/v2/$image/blobs/$digest" \
49+
| jq -r ".config.Labels.\"$label\""
50+
}
51+
52+
_get_token() {
53+
local image=$1
54+
curl \
55+
--silent \
56+
"https://auth.docker.io/token?scope=repository:$image:pull&service=registry.docker.io" \
57+
| jq -r '.token'
58+
}
59+
60+
_get_digest() {
61+
local image=$1
62+
local tag=$2
63+
local token=$3
64+
curl \
65+
--silent \
66+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
67+
--header "Authorization: Bearer $token" \
68+
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
69+
| jq -r '.config.digest'
70+
}
71+
72+
_get_layers() {
73+
local image=$1
74+
local tag=$2
75+
local token=$3
76+
curl \
77+
--silent \
78+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
79+
--header "Authorization: Bearer $token" \
80+
"https://registry-1.docker.io/v2/$image/manifests/$tag" \
81+
| jq -r '.layers[].digest'
82+
}

build-branches.sh renamed to build-next.sh

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,17 @@ GITHUB_REPO="${GITHUB_REPO-$ORIGINAL_GITHUB_REPO}"
2323
URL_RELEASES="https://api.github.com/repos/${GITHUB_REPO}/branches?${GITHUB_OAUTH_PARAMS}"
2424

2525
# Composing the JQ commans to extract the most recent version number
26-
JQ_BRANCHES='map(.name) | .[] | scan("^[^v].+") | match("^(master|develop).*") | .string'
26+
JQ_NEXT='map(.name) | .[] | scan("^[^v].+") | match("^(develop-).*") | .string'
2727

2828
CURL="curl -sS"
2929

3030
# Querying the Github API to fetch all branches
31-
BRANCHES=$($CURL "${URL_RELEASES}" | jq -r "$JQ_BRANCHES")
31+
NEXT=$($CURL "${URL_RELEASES}" | jq -r "$JQ_NEXT")
3232

33-
###
34-
# Building each branch
35-
###
36-
37-
# keeping track whether an error occured
38-
ERROR=0
39-
40-
# calling build.sh for each branch
41-
for BRANCH in $BRANCHES; do
33+
if [ -n "$NEXT" ]; then
4234
# shellcheck disable=SC2068
43-
./build.sh "${BRANCH}" $@ || ERROR=1
44-
done
45-
46-
# returning whether an error occured
47-
exit $ERROR
35+
./build.sh "${NEXT}" $@
36+
else
37+
echo "No branch matching 'develop-*' found"
38+
echo "::set-output name=skipped::true"
39+
fi

0 commit comments

Comments
 (0)