Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new skaffold site #1338

Merged
merged 23 commits into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ examples/bazel/bazel-*
integration/examples/bazel/bazel-*
*.new
.idea/
docs/generated
docs/.firebase
docs/firebase-debug*
docs/public
docs/resources
docs/node_modules
docs/package-lock.json
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "docsy"]
active = true
path = docs/themes/docsy
url = https://github.com/google/docsy
22 changes: 13 additions & 9 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,20 +111,25 @@ for submitted PRs._

## Building skaffold docs

The latest version of the skaffold site is based on the Hugo theme of the github.com/google/docsy template.

### Testing docs locally

Before [creating a PR](#creating-a-pr) with doc changes, we recommend that you locally verify the
generated docs with:

```shell
make docs
make preview-docs
```
Once PRs with doc changes are merged, they will get automatically published to the docs
for the latest build to https://skaffold-latest.firebaseapp.com.
which at release time will be published with the latest release to https://skaffold.dev.

And then open the generated docs/generated folder for `index.html` and `index.pdf`.
### Previewing the docs on the PR

Once PRs with doc changes are merged, they will get automatically published to the docs
for [the latest build](https://storage.googleapis.com/skaffold/builds/latest/docs/index.html)
which at release time will be published with [the latest release](https://storage.googleapis.com/skaffold/releases/latest/docs/index.html).
Mark your PR with `docs-modifications` label. Our PR review process will answer in comments in ~5 minutes with the URL of your preview and will remove the label.

## Testing and contributing to the Skaffold release process
## Testing the Skaffold binary release process

Skaffold release process works with Google Cloud Build within our own project `k8s-skaffold` and the skaffold release bucket, `gs://skaffold`.

Expand All @@ -135,15 +140,15 @@ We continuously release **builds** under `gs://skaffold/builds`. This is done by
To run a build on your own project:

```
gcloud builds submit --config deploy/cloudbuild.yaml --substitutions=_RELEASE_BUCKET=<personal-bucket>,COMMIT_SHA=$(git rev-parse HEAD)
gcloud builds submit --config deploy/cloudbuild.yaml --substitutions=_RELEASE_BUCKET=<personal-bucket>,COMMIT_SHA=$(git rev-parse HEAD) --project <personalproject>
```

We **release** stable versions under `gs://skaffold/releases`. This is done by triggering `cloudbuild-release.yaml` on every new tag in our Github repo.

To test a release on your own project:

```
gcloud builds submit --config deploy/cloudbuild-release.yaml --substitutions=_RELEASE_BUCKET=<personal-bucket>,TAG_NAME=testrelease_v1234
gcloud builds submit --config deploy/cloudbuild-release.yaml --substitutions=_RELEASE_BUCKET=<personal-bucket>,TAG_NAME=testrelease_v1234 --project <personalproject>
```

Note: if gcloud submit fails with something similar to the error message below, run `dep ensure && dep prune` to remove the broken symlinks
Expand All @@ -152,7 +157,6 @@ ERROR: gcloud crashed (OSError): [Errno 2] No such file or directory: './vendor/

```


To just run a release without Google Cloud Build only using your local Docker daemon, you can run:

```
Expand Down
39 changes: 18 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
GOOS ?= $(shell go env GOOS)
GOARCH = amd64
BUILD_DIR ?= ./out
DOCS_DIR ?= ./docs/generated
ORG := github.com/GoogleContainerTools
PROJECT := skaffold
REPOPATH ?= $(ORG)/$(PROJECT)
Expand All @@ -34,6 +33,7 @@ BUILD_PACKAGE = $(REPOPATH)/cmd/skaffold

VERSION_PACKAGE = $(REPOPATH)/pkg/skaffold/version
COMMIT = $(shell git rev-parse HEAD)
BASE_URL ?= https://skaffold.dev
VERSION ?= $(shell git describe --always --tags --dirty)

GO_GCFLAGS := "all=-trimpath=${PWD}"
Expand Down Expand Up @@ -91,15 +91,14 @@ coverage: $(BUILD_DIR)
go test -coverprofile=$(BUILD_DIR)/coverage.txt -covermode=atomic ./...

.PHONY: release
release: cross docs $(BUILD_DIR)/VERSION
release: cross $(BUILD_DIR)/VERSION
docker build \
-f deploy/skaffold/Dockerfile \
--cache-from gcr.io/$(GCP_PROJECT)/skaffold-builder \
--build-arg VERSION=$(VERSION) \
-t gcr.io/$(GCP_PROJECT)/skaffold:$(VERSION) .
gsutil -m cp $(BUILD_DIR)/$(PROJECT)-* $(GSC_RELEASE_PATH)/
gsutil -m cp $(BUILD_DIR)/VERSION $(GSC_RELEASE_PATH)/VERSION
gsutil -m cp -r $(DOCS_DIR)/* $(GSC_RELEASE_PATH)/docs/
gsutil -m cp -r $(GSC_RELEASE_PATH)/* $(GSC_RELEASE_LATEST)

.PHONY: release-in-docker
Expand All @@ -115,14 +114,13 @@ release-in-docker:
gcr.io/$(GCP_PROJECT)/skaffold-builder make -j release VERSION=$(VERSION) RELEASE_BUCKET=$(RELEASE_BUCKET) GCP_PROJECT=$(GCP_PROJECT)

.PHONY: release-build
release-build: cross docs
release-build: cross
docker build \
-f deploy/skaffold/Dockerfile \
--cache-from gcr.io/$(GCP_PROJECT)/skaffold-builder \
-t gcr.io/$(GCP_PROJECT)/skaffold:latest \
-t gcr.io/$(GCP_PROJECT)/skaffold:$(COMMIT) .
gsutil -m cp $(BUILD_DIR)/$(PROJECT)-* $(GSC_BUILD_PATH)/
gsutil -m cp -r $(DOCS_DIR)/* $(GSC_BUILD_PATH)/docs/
gsutil -m cp -r $(GSC_BUILD_PATH)/* $(GSC_BUILD_LATEST)

.PHONY: release-build-in-docker
Expand All @@ -139,7 +137,7 @@ release-build-in-docker:

.PHONY: clean
clean:
rm -rf $(BUILD_DIR) $(DOCS_DIR)
rm -rf $(BUILD_DIR) ./docs/public ./docs/resources

.PHONY: integration-in-docker
integration-in-docker:
Expand All @@ -156,21 +154,6 @@ integration-in-docker:
-e GOOGLE_APPLICATION_CREDENTIALS=$(GOOGLE_APPLICATION_CREDENTIALS) \
gcr.io/$(GCP_PROJECT)/skaffold-integration

.PHONY: docs
docs:
hack/build_docs.sh $(VERSION) $(COMMIT)

.PHONY: docs-in-docker
docs-in-docker:
docker build \
-f deploy/skaffold/Dockerfile \
-t skaffold-builder \
--target builder \
.
docker run \
-v $(PWD):/go/src/$(REPOPATH) \
skaffold-builder make docs

.PHONY: submit-build-trigger
submit-build-trigger:
gcloud container builds submit . \
Expand All @@ -183,7 +166,21 @@ submit-release-trigger:
--config=deploy/cloudbuild-release.yaml \
--substitutions="_RELEASE_BUCKET=$(RELEASE_BUCKET),TAG_NAME=$(VERSION)"

#utilities for skaffold site - not used anywhere else

.PHONY: docs-controller-image
docs-controller-image:
docker build -t gcr.io/$(GCP_PROJECT)/docs-controller -f deploy/webhook/Dockerfile .

.PHONY: preview-docs
preview-docs:
docker build -t skaffold-docs-previewer -f deploy/webhook/Dockerfile --target runtime_deps .
docker run -ti -v $(PWD):/app --workdir /app/docs -p 1313:1313 skaffold-docs-previewer bash -xc "git submodule init && \
git submodule update --init --recursive && \
npm i -D autoprefixer && \
hugo && \
hugo serve --bind=0.0.0.0 -D && \
rm -rf public resources node_modules package-lock.json && \
git submodule deinit -f . && \
rm -rf /app/docs/themes/docsy/* && \
rm -rf /app/.git/modules/docsy"
34 changes: 34 additions & 0 deletions deploy/docs/cloudbuild-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
steps:

# Download the latest version of the builder image
- name: gcr.io/cloud-builders/docker
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/$PROJECT_ID/docs-controller:latest || exit 0
# until https://github.com/GoogleCloudPlatform/cloud-builders/issues/253 is fixed

# Build and push latest version of the docs-controller image
- name: gcr.io/cloud-builders/docker
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/docs-controller:latest'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/docs-controller:latest'
- '-f'
- 'deploy/webhook/Dockerfile'
- '.'

- name: gcr.io/$PROJECT_ID/docs-controller:latest
dir: docs
args:
- 'bash'
- '-xc'
- |
git submodule init && git submodule update --init --recursive && npm i -D autoprefixer && hugo && firebase deploy --only hosting:release --project $PROJECT_ID

images: [
'gcr.io/$PROJECT_ID/docs-controller:latest'
]
33 changes: 33 additions & 0 deletions deploy/docs/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
steps:

# Download the latest version of the docs-controller image
- name: gcr.io/cloud-builders/docker
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/$PROJECT_ID/docs-controller:latest || exit 0
# until https://github.com/GoogleCloudPlatform/cloud-builders/issues/253 is fixed

# Build and push latest version of the docs-controller image
- name: gcr.io/cloud-builders/docker
args:
- 'build'
- '-t'
- 'gcr.io/$PROJECT_ID/docs-controller:latest'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/docs-controller:latest'
- '-f'
- 'deploy/webhook/Dockerfile'
- '.'

- name: gcr.io/$PROJECT_ID/docs-controller:latest
dir: docs
args:
- 'bash'
- '-xc'
- |
git submodule init && git submodule update --init --recursive && npm i -D autoprefixer && hugo --baseUrl https://skaffold-latest.firebaseapp.com && firebase deploy --only hosting:head --project $PROJECT_ID

images:
- 'gcr.io/$PROJECT_ID/docs-controller:latest'
7 changes: 0 additions & 7 deletions deploy/skaffold/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ ENV PATH /usr/local/go/bin:/go/bin:/google-cloud-sdk/bin:$PATH

FROM runtime_deps as builder

ENV ASCIIDOCTOR_VERSION=1.5.7.1
ENV ASCIIDOCTOR_PDF_VERSION=1.5.0.alpha.16
RUN apt-get update && apt-get install --no-install-recommends --no-install-suggests -y \
ca-certificates \
curl \
Expand All @@ -75,12 +73,7 @@ RUN apt-get update && apt-get install --no-install-recommends --no-install-sugge
python-setuptools \
lsb-release \
software-properties-common \
ruby-dev \
apt-transport-https && \
rm -rf /var/lib/apt/lists/* && \
gem install --no-document "asciidoctor-pdf:${ASCIIDOCTOR_PDF_VERSION}" \
asciidoctor:${ASCIIDOCTOR_VERSION} \
pygments.rb rouge && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
apt-key fingerprint 0EBFCD88 && \
add-apt-repository \
Expand Down
25 changes: 16 additions & 9 deletions deploy/webhook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.10
WORKDIR $GOPATH/src/github.com/GoogleContainerTools/skaffold
COPY . .
RUN go build -o /webhook webhook/webhook.go


FROM gcr.io/gcp-runtimes/ubuntu_16_0_4 as runtime_deps

ENV KUBECTL_VERSION v1.12.0
RUN curl -Lo /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
chmod +x /usr/local/bin/kubectl


ENV HUGO_VERSION=0.51
RUN curl -LO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz && \
tar -xzf hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz && \
mv hugo /usr/local/bin/hugo

RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
# required for nodejs
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
apt-get update && \
# required for hugo
apt-get install -y git \
nodejs
# required for hugo, firebase
nodejs && \
# required for hugo
npm install -g postcss-cli \
# required for releasing the docs
firebase-tools

FROM golang:1.10 as webhook
WORKDIR $GOPATH/src/github.com/GoogleContainerTools/skaffold
COPY . .
RUN go build -o /webhook webhook/webhook.go

COPY --from=0 /webhook /webhook
FROM runtime_deps
COPY --from=webhook /webhook /webhook
30 changes: 14 additions & 16 deletions deploy/webhook/cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
steps:
# Get cluster credentials
- name: gcr.io/k8s-skaffold/skaffold:v0.16.0

# Download the latest version of the docs-controller image
- name: gcr.io/cloud-builders/docker
entrypoint: 'bash'
args:
- '-c'
- |
docker pull gcr.io/$PROJECT_ID/docs-controller:latest || exit 0
# until https://github.com/GoogleCloudPlatform/cloud-builders/issues/253 is fixed

# Get cluster credentials
- name: gcr.io/k8s-skaffold/skaffold:v0.18.0
args:
- 'gcloud'
- 'container'
Expand All @@ -12,23 +22,11 @@ steps:
- '--project'
- 'k8s-skaffold'
# Build and push the image with the :commit_sha tag
- name: gcr.io/k8s-skaffold/skaffold:v0.16.0
- name: gcr.io/k8s-skaffold/skaffold:v0.18.0
args:
- 'skaffold'
- '-f'
- 'deploy/webhook/skaffold.yaml'
- 'run'
- '--tag'
- '${COMMIT_SHA}'
# Build and push latest version of the docs-controller image
- name: gcr.io/cloud-builders/docker
args:
- 'build'
- '-t'
- 'gcr.io/k8s-skaffold/docs-controller:latest'
- '-f'
- 'deploy/webhook/Dockerfile'
- '.'
images: [
'gcr.io/k8s-skaffold/docs-controller:latest'
]
- '${COMMIT_SHA}'
4 changes: 3 additions & 1 deletion deploy/webhook/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apiVersion: skaffold/v1alpha4
apiVersion: skaffold/v1alpha5
kind: Config
build:
artifacts:
- image: gcr.io/k8s-skaffold/docs-controller
docker:
dockerfile: deploy/webhook/Dockerfile
cacheFrom:
- gcr.io/k8s-skaffold/docs-controller
deploy:
kubectl:
manifests:
Expand Down
Binary file added docs/.DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions docs/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"targets": {
"k8s-skaffold": {
"hosting": {
"release": [
"k8s-skaffold"
],
"head": [
"skaffold-latest"
]
}
}
}
}
2 changes: 2 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Skaffold site

1 change: 0 additions & 1 deletion docs/_config.yml

This file was deleted.

Loading