Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
Jupyter Docker Stacks
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Jupyter Docker Stacks
Commits
feacdbfc
Commit
feacdbfc
authored
Oct 12, 2020
by
Romain
Committed by
GitHub
Oct 12, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1176 from mathbunnyru/asalikhov/pre_commit
Run pre-commit hooks server side
parents
c47a268c
668cc931
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
32 deletions
+23
-32
.github/workflows/docker.yml
.github/workflows/docker.yml
+4
-2
.pre-commit-config.yaml
.pre-commit-config.yaml
+0
-11
Makefile
Makefile
+8
-8
datascience-notebook/hooks/run_hook
datascience-notebook/hooks/run_hook
+1
-1
docs/contributing/lint.md
docs/contributing/lint.md
+10
-10
No files found.
.github/workflows/docker.yml
View file @
feacdbfc
...
@@ -40,9 +40,11 @@ jobs:
...
@@ -40,9 +40,11 @@ jobs:
-
name
:
Install Dev Dependencies
-
name
:
Install Dev Dependencies
run
:
|
run
:
|
python -m pip install --upgrade pip
python -m pip install --upgrade pip
make -C main dev-env lint-install
make -C main dev-env
hado
lint-install
-
name
:
Lint Dockerfiles
-
name
:
Lint Dockerfiles
run
:
make -C main lint-all
run
:
make -C main hadolint-all
-
name
:
Run pre-commit hooks
run
:
make -C main pre-commit-all
-
name
:
Build Docker Images
-
name
:
Build Docker Images
run
:
make -C main build-test-all
run
:
make -C main build-test-all
-
name
:
Run Post-Build Hooks
-
name
:
Run Post-Build Hooks
...
...
.pre-commit-config.yaml
View file @
feacdbfc
...
@@ -24,14 +24,3 @@ repos:
...
@@ -24,14 +24,3 @@ repos:
rev
:
v1.5.4
rev
:
v1.5.4
hooks
:
hooks
:
-
id
:
autopep8
-
id
:
autopep8
-
repo
:
local
hooks
:
-
id
:
hadolint
name
:
Hadolint linter
description
:
Runs Hadolint to check for Dockerfile best practices
language
:
system
# Exclude ppc64le Dockerfile since cannot check their build easily
exclude
:
ppc64
types
:
-
dockerfile
entry
:
hadolint
Makefile
View file @
feacdbfc
...
@@ -23,7 +23,7 @@ endif
...
@@ -23,7 +23,7 @@ endif
ALL_IMAGES
:=
$(ALL_STACKS)
ALL_IMAGES
:=
$(ALL_STACKS)
# Linter
#
Dockerfile
Linter
HADOLINT
=
"
${HOME}
/hadolint"
HADOLINT
=
"
${HOME}
/hadolint"
HADOLINT_VERSION
=
"v1.18.0"
HADOLINT_VERSION
=
"v1.18.0"
...
@@ -121,25 +121,25 @@ img-rm-dang: ## remove dangling images (tagged None)
...
@@ -121,25 +121,25 @@ img-rm-dang: ## remove dangling images (tagged None)
@
echo
"Removing dangling images ..."
@
echo
"Removing dangling images ..."
-
docker rmi
--force
$(
shell
docker images
-f
"dangling=true"
-q
)
2> /dev/null
-
docker rmi
--force
$(
shell
docker images
-f
"dangling=true"
-q
)
2> /dev/null
lint/%
:
ARGS?=
hado
lint/%
:
ARGS?=
lint/%
:
##
lint the dockerfile(s) for a stack
hado
lint/%
:
##
lint the dockerfile(s) for a stack
@
echo
"Linting Dockerfiles in
$(
notdir
$@
)
..."
@
echo
"Linting Dockerfiles in
$(
notdir
$@
)
..."
@
git ls-files
--exclude
=
'Dockerfile*'
--ignored
$(
notdir
$@
)
|
grep
-v
ppc64 | xargs
-L
1
$(HADOLINT)
$(ARGS)
@
git ls-files
--exclude
=
'Dockerfile*'
--ignored
$(
notdir
$@
)
|
grep
-v
ppc64 | xargs
-L
1
$(HADOLINT)
$(ARGS)
@
echo
"Linting done!"
@
echo
"Linting done!"
lint-all
:
$(foreach I
,
$(ALL_IMAGES)
,
lint/$(I) )
##
lint all stacks
hadolint-all
:
$(foreach I
,
$(ALL_IMAGES)
,
hado
lint/$(I) )
##
lint all stacks
lint-build-test-all
:
$(foreach I
,
$(ALL_IMAGES)
,
lint/$(I) arch_patch/$(I) build/$(I) test/$(I) )
##
lint
,
build and test all stacks
hadolint-build-test-all
:
$(foreach I
,
$(ALL_IMAGES)
,
hado
lint/$(I) arch_patch/$(I) build/$(I) test/$(I) )
##
lint
,
build and test all stacks
lint-install
:
##
install hadolint
hado
lint-install
:
##
install hadolint
@
echo
"Installing hadolint at
$(HADOLINT)
..."
@
echo
"Installing hadolint at
$(HADOLINT)
..."
@
curl
-sL
-o
$(HADOLINT)
"https://github.com/hadolint/hadolint/releases/download/
$(HADOLINT_VERSION)
/hadolint-
$(
shell
uname -s
)
-
$(
shell
uname -m
)
"
@
curl
-sL
-o
$(HADOLINT)
"https://github.com/hadolint/hadolint/releases/download/
$(HADOLINT_VERSION)
/hadolint-
$(
shell
uname -s
)
-
$(
shell
uname -m
)
"
@
chmod
700
$(HADOLINT)
@
chmod
700
$(HADOLINT)
@
echo
"Installation done!"
@
echo
"Installation done!"
@
$(HADOLINT)
--version
@
$(HADOLINT)
--version
pre-commit-all
:
##
run pre-commit hook on all files
pre-commit-all
:
##
run pre-commit hook on all files
@
pre-commit run
--all
@
pre-commit run
--all
-files
pre-commit-install
:
##
set up the git hook scripts
pre-commit-install
:
##
set up the git hook scripts
@
pre-commit
--version
@
pre-commit
--version
...
...
datascience-notebook/hooks/run_hook
View file @
feacdbfc
...
@@ -75,4 +75,4 @@ $(docker run --rm ${IMAGE_NAME} R --silent -e 'installed.packages(.Library)[, c(
...
@@ -75,4 +75,4 @@ $(docker run --rm ${IMAGE_NAME} R --silent -e 'installed.packages(.Library)[, c(
\`\`\`
\`\`\`
$(
docker run
--rm
${
IMAGE_NAME
}
apt list
--installed
)
$(
docker run
--rm
${
IMAGE_NAME
}
apt list
--installed
)
\`\`\`
\`\`\`
EOF
EOF
\ No newline at end of file
docs/contributing/lint.md
View file @
feacdbfc
...
@@ -8,7 +8,7 @@ To integrate and enforce this process in the project lifecycle we are using **gi
...
@@ -8,7 +8,7 @@ To integrate and enforce this process in the project lifecycle we are using **gi
### Installation
### Installation
pre-commit is a Python package that needs to be installed.
pre-commit is a Python package that needs to be installed.
This can be achieved by using the generic task used to install all Python development dependencies.
This can be achieved by using the generic task used to install all Python development dependencies.
```
sh
```
sh
...
@@ -21,7 +21,7 @@ $ pip install pre-commit
...
@@ -21,7 +21,7 @@ $ pip install pre-commit
Then the git hooks scripts configured for the project in
`.pre-commit-config.yaml`
need to be installed in the local git repository.
Then the git hooks scripts configured for the project in
`.pre-commit-config.yaml`
need to be installed in the local git repository.
```
sh
```
sh
$
make pre-commit-install
$
make pre-commit-install
```
```
### Run
### Run
...
@@ -43,7 +43,7 @@ There is a specific `make` target to install the linter.
...
@@ -43,7 +43,7 @@ There is a specific `make` target to install the linter.
By default
`hadolint`
will be installed in
`${HOME}/hadolint`
.
By default
`hadolint`
will be installed in
`${HOME}/hadolint`
.
```
bash
```
bash
$
make lint-install
$
make
hado
lint-install
# Installing hadolint at /Users/romain/hadolint ...
# Installing hadolint at /Users/romain/hadolint ...
# Installation done!
# Installation done!
...
@@ -57,7 +57,7 @@ $ make lint-install
...
@@ -57,7 +57,7 @@ $ make lint-install
The linter can be run per stack.
The linter can be run per stack.
```
bash
```
bash
$
make
lint/scipy-notebook
$
make
hadolint/scipy-notebook
# Linting Dockerfiles in scipy-notebook...
# Linting Dockerfiles in scipy-notebook...
# scipy-notebook/Dockerfile:4 DL3006 Always tag the version of an image explicitly
# scipy-notebook/Dockerfile:4 DL3006 Always tag the version of an image explicitly
...
@@ -69,11 +69,11 @@ $ make lint/scipy-notebook
...
@@ -69,11 +69,11 @@ $ make lint/scipy-notebook
# make: *** [lint/scipy-notebook] Error 1
# make: *** [lint/scipy-notebook] Error 1
```
```
Optionally you can pass arguments to the
linter
.
Optionally you can pass arguments to the
hadolint
.
```
bash
```
bash
# Use a different export format
# Use a different export format
$
make
lint/scipy-notebook
ARGS
=
"--format codeclimate"
$
make
hadolint/scipy-notebook
ARGS
=
"--format codeclimate"
```
```
#### All the Stacks
#### All the Stacks
...
@@ -81,16 +81,16 @@ $ make lint/scipy-notebook ARGS="--format codeclimate"
...
@@ -81,16 +81,16 @@ $ make lint/scipy-notebook ARGS="--format codeclimate"
The linter can be run against all the stacks.
The linter can be run against all the stacks.
```
bash
```
bash
$
make lint-all
$
make
hado
lint-all
```
```
### Ignoring Rules
### Ignoring Rules
Sometimes it is necessary to ignore
[
some rules
][
rules
]
.
Sometimes it is necessary to ignore
[
some rules
][
rules
]
.
The following rules are ignored by default and sor for all images in the
`.hadolint.yaml`
file.
The following rules are ignored by default and sor for all images in the
`.hadolint.yaml`
file.
-
[
`DL3006`
][
DL3006
]
: We use a specific policy to manage image tags.
-
[
`DL3006`
][
DL3006
]
: We use a specific policy to manage image tags.
-
`base-notebook`
`FROM`
clause is fixed but based on an argument (
`ARG`
).
-
`base-notebook`
`FROM`
clause is fixed but based on an argument (
`ARG`
).
-
Building downstream images from (
`FROM`
) the latest is done on purpose.
-
Building downstream images from (
`FROM`
) the latest is done on purpose.
-
[
`DL3008`
][
DL3008
]
: System packages are always updated (
`apt-get`
) to the latest version.
-
[
`DL3008`
][
DL3008
]
: System packages are always updated (
`apt-get`
) to the latest version.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment