Skip to content

Commit

Permalink
infra: add set up for blog (#11981)
Browse files Browse the repository at this point in the history
Adds a blog set up that will make it easy to publish new posts.

You can test this locally by running the `build_blog.sh` script from the
directory of the script. You'll need to have hugo for this, which you
can do in the same way as the Dockerfile:

```sh
RUN mkdir -p hugo-bin && \
    cd hugo-bin && \
    wget https://github.com/gohugoio/hugo/releases/download/v0.126.1/hugo_extended_0.126.1_linux-amd64.tar.gz && \
    tar -xzf hugo_extended_0.126.1_linux-amd64.tar.gz

ENV PATH="${PATH}:/hugo-bin/"
```

---------

Signed-off-by: David Korczynski <david@adalogics.com>
  • Loading branch information
DavidKorczynski committed May 21, 2024
1 parent e6878ad commit 97a0c5a
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
2 changes: 2 additions & 0 deletions infra/build/blog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
oss-fuzz-blog
hugo-coder
37 changes: 37 additions & 0 deletions infra/build/blog/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
FROM python:3.11-bullseye

# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True

RUN mkdir -p hugo-bin && \
cd hugo-bin && \
wget https://github.com/gohugoio/hugo/releases/download/v0.126.1/hugo_extended_0.126.1_linux-amd64.tar.gz && \
tar -xzf hugo_extended_0.126.1_linux-amd64.tar.gz

ENV PATH="${PATH}:/hugo-bin/"

RUN git clone https://github.com/luizdepra/hugo-coder hugo-coder && \
cd hugo-coder && \
git checkout 759cc945636473d251a28597e2007cbb7d11631d # 17th May 2024

COPY content /content
COPY hugo.toml /hugo.toml
COPY build_blog.sh /build_blog.sh
RUN /build_blog.sh

CMD exec python3 -m http.server 8011 -d /oss-fuzz-blog/page/public
54 changes: 54 additions & 0 deletions infra/build/blog/build_blog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash -eux
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################

BASE=$PWD

if [ -d "${BASE}/hugo-coder" ]
then
echo "Local version of hugo exists. Using this."
else
# When writing the blog outeside of docker we clone Hugo here.
git clone https://github.com/luizdepra/hugo-coder hugo-coder
cd hugo-coder
git checkout 759cc945636473d251a28597e2007cbb7d11631d # 17th May 2024
cd ../
fi

# Build the site
if [ -d "${BASE}/oss-fuzz-blog" ]
then
rm -rf ${BASE}/oss-fuzz-blog
fi
mkdir oss-fuzz-blog
cd oss-fuzz-blog

hugo new site page
cd page

git init

# Copy over our content
cp -rf ${BASE}/hugo-coder themes/hugo-coder
cp $BASE/hugo.toml .
rm -rf ./content
cp -rf $BASE/content .

# Build the site
hugo -D

# Uncomment the following to launch site automatically
#python3 -m http.server 8011 -d ./oss-fuzz-blog/page/public
13 changes: 13 additions & 0 deletions infra/build/blog/content/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
+++
title = "About"
description = "OSS-Fuzz's blog"
date = "2024-05-20"
aliases = ["about-us", "about-oss-fuzz", "contact"]
author = "OSS-Fuzz maintainers"
+++

This is a blog for updates, research and initiatives of the OSS-Fuzz project.
OSS-Fuzz is an open source fuzzing framework focused on large scale fuzzing
of open source projects. The efforts described in this blog focuses on this
domain and includes both feature updates to OSS-Fuzz itself as well as insights
into research and development efforts of OSS-Fuzz.
Binary file added infra/build/blog/content/images/oss-fuzz-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions infra/build/blog/content/posts/oss-fuzz-hello-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
+++
authors = ["OSS-Fuzz Maintainers"]
title = "OSS-Fuzz blog"
date = "2024-05-20"
description = "Introduction to the OSS-Fuzz blog"
tags = [
"fuzzing",
"blogging",
]
categories = [
"introduction",
]
+++

Welcome to the new OSS-Fuzz blog! In this place we will publish feature
updates, research efforts and all-things OSS-Fuzz related.
52 changes: 52 additions & 0 deletions infra/build/blog/hugo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
seURL = ''
languageCode = 'en-us'
title = 'OSS-Fuzz blog'
theme = 'hugo-coder'

languagecode = "en"
defaultcontentlanguage = "en"

paginate = 20

[markup.highlight]
style = "github-dark"

[params]
info = "Fuzzing Open Source Software at Scale"
description = "OSS-Fuzz fuzzing blog"
keywords = "fuzzing, vulnerability research, open source, security"
avatarurl = "images/oss-fuzz-logo.png"

faviconSVG = "/img/favicon.svg"
favicon_32 = "/img/favicon-32x32.png"
favicon_16 = "/img/favicon-16x16.png"

since = 2024

enableTwemoji = true

colorScheme = "auto"
hidecolorschemetoggle = false

[taxonomies]
category = "categories"
series = "series"
tag = "tags"
author = "authors"

# Social links
[[params.social]]
name = "Github"
icon = "fa-brands fa-github fa-2x"
weight = 1
url = "https://github.com/google/oss-fuzz"

# Menu links
[[menu.main]]
name = "Blog"
weight = 1
url = "posts/"
[[menu.main]]
name = "About"
weight = 2
url = "about/"

0 comments on commit 97a0c5a

Please sign in to comment.