Skip to content

Commit

Permalink
Added serverless (#26)
Browse files Browse the repository at this point in the history
* Added serverless

* Updated podman 2.2.1-3.0.1, skopeo 1.2.0-1.2.2, golang 1.15.6-1.16.7 and added serverless

* Updated podman 2.2.1-3.0.1, skopeo 1.2.0-1.2.2, golang 1.15.6-1.16.7 and added serverless

* Ignored hadolint DL3041, DL3042, DL3047, DL3059

* Updated golangci_lint 1.34.1-1.41.1

* Desperation check for podman/skopeo version syntax

* Update gocritic URL

* Update gocritic_spec to properly retrieve version

* Updated gocritic_spec again

* Updated gocritic_spec to dynamically fetch checkers directory

* Updated syntax of dynamic search

* Updated podman 3.0.1-3.2.3

* Adding logic to deal with skopeo having different versions

* gocritic specfile update

* gocritic_spec change

* Removed hadolint ignores on DL3042 and DL3047

* Removed src/.DS_store and adjusted skopeo_spec formatting

* skopeo_spec formatting

Co-authored-by: stascavageb <brian.stascavage@saic.com>
  • Loading branch information
shawju and stascavageb authored Aug 17, 2021
1 parent b60e23e commit e7d5a57
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ repos:
hooks:
- id: shellcheck
exclude: spec/*
- repo: https://github.com/prettier/prettier
rev: 2.1.2
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.2
hooks:
- id: prettier
- repo: https://github.com/jas-on/pre-commit-hadolint
Expand Down
2 changes: 1 addition & 1 deletion spec/gocritic_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Describe "printVersion()"
printVersion() {
gocritic version
cd $(find / -name "go-critic@*" -type d 2> /dev/null | head -n1); cd checkers; gocritic version
}

It "validates tool is installed by checking version"
Expand Down
2 changes: 1 addition & 1 deletion spec/podman_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Describe "printVersion()"
printVersion() {
podman --version | grep "${PODMAN_VERSION}"
podman -v | grep "${PODMAN_VERSION}"
}

It "validates tool is installed by checking version"
Expand Down
13 changes: 13 additions & 0 deletions spec/serverless_spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env shellspec

Describe "printVersion()"
printVersion() {
serverless --version | grep "${SERVERLESS_VERSION}"
}

It "validates tool is installed by checking version"
When call printVersion
The output should include "${SERVERLESS_VERSION}"
The status should eq 0
End
End
4 changes: 2 additions & 2 deletions spec/skopeo_spec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

Describe "printVersion()"
printVersion() {
skopeo -v | grep "${SKOPEO_VERSION}"
skopeo -v | grep "${SKOPEO_BINARY_VERSION}"
}

It "validates tool is installed by checking version"
When call printVersion
The output should include "${SKOPEO_VERSION}"
The output should include "${SKOPEO_BINARY_VERSION}"
The status should eq 0
End
End
43 changes: 29 additions & 14 deletions src/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ ENV DOCKER_VERION=${DOCKER_VERSION}
# shouldn't ever need version pinning
# Please keep the list alphabetized for maintainability

# hadolint ignore=DL3041
RUN dnf install -y --refresh \
bind-utils \
bzip2 \
Expand Down Expand Up @@ -77,7 +78,7 @@ RUN git clone --branch "${SHELLSPEC_VERSION}" --depth 1 https://github.com/shell
ARG GO_TASK_VERSION="3.0.0"
ENV GO_TASK_VERSION=${GO_TASK_VERSION}
# hadolint ignore=DL3003
RUN wget -O /root/task.tar.gz "https://github.com/go-task/task/releases/download/v${GO_TASK_VERSION}/task_linux_amd64.tar.gz" \
RUN wget -O /root/task.tar.gz --progress=dot:giga "https://github.com/go-task/task/releases/download/v${GO_TASK_VERSION}/task_linux_amd64.tar.gz" \
&& (cd /usr/local/bin && tar -xzvf /root/task.tar.gz task) \
&& rm -f /root/task.tar.gz \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*
Expand All @@ -86,30 +87,30 @@ RUN wget -O /root/task.tar.gz "https://github.com/go-task/task/releases/download
ARG SHELLCHECK_VERSION="0.7.1"
ENV SHELLCHECK_VERSION=${SHELLCHECK_VERSION}
# hadolint ignore=DL3003
RUN wget -O /root/shellcheck.tar.xz "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" \
RUN wget -O /root/shellcheck.tar.xz --progress=dot:giga "https://github.com/koalaman/shellcheck/releases/download/v${SHELLCHECK_VERSION}/shellcheck-v${SHELLCHECK_VERSION}.linux.x86_64.tar.xz" \
&& (cd /usr/local/bin && tar -xJvf /root/shellcheck.tar.xz --strip-components=1 "shellcheck-v${SHELLCHECK_VERSION}/shellcheck") \
&& rm -f /root/shellcheck.tar.xz \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install hadolint. Get versions from https://github.com/hadolint/hadolint/releases
ARG HADOLINT_VERSION="1.18.0"
ENV HADOLINT_VERSION=${HADOLINT_VERSION}
RUN wget -O /usr/local/bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-Linux-x86_64" \
RUN wget -O /usr/local/bin/hadolint --progress=dot:giga "https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-Linux-x86_64" \
&& chmod +x /usr/local/bin/hadolint \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install klar. Get versions from https://github.com/optiopay/klar/releases
ARG KLAR_VERSION="2.4.0"
ENV KLAR_VERSION=${KLAR_VERSION}
RUN wget -O /usr/local/bin/klar "https://github.com/optiopay/klar/releases/download/v${KLAR_VERSION}/klar-${KLAR_VERSION}-linux-amd64" \
RUN wget -O /usr/local/bin/klar --progress=dot:giga "https://github.com/optiopay/klar/releases/download/v${KLAR_VERSION}/klar-${KLAR_VERSION}-linux-amd64" \
&& chmod +x /usr/local/bin/klar \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install Fossa cli. Get versions from https://github.com/fossas/fossa-cli/releases
ARG FOSSA_VERSION="1.0.30"
ENV FOSSA_VERSION=${FOSSA_VERSION}
# hadolint ignore=DL3003
RUN wget -O /root/fossa.tar.gz "https://github.com/fossas/fossa-cli/releases/download/v${FOSSA_VERSION}/fossa-cli_${FOSSA_VERSION}_linux_amd64.tar.gz" \
RUN wget -O /root/fossa.tar.gz --progress=dot:giga "https://github.com/fossas/fossa-cli/releases/download/v${FOSSA_VERSION}/fossa-cli_${FOSSA_VERSION}_linux_amd64.tar.gz" \
&& (cd /usr/local/bin && tar -xzvf /root/fossa.tar.gz fossa) \
&& chmod +x /usr/local/bin/fossa \
&& rm -f /root/fossa.tar.gz \
Expand All @@ -118,33 +119,40 @@ RUN wget -O /root/fossa.tar.gz "https://github.com/fossas/fossa-cli/releases/dow
# Install Gomplate. Get versions from https://github.com/hairyhenderson/gomplate/releases
ARG GOMPLATE_VERSION="3.7.0"
ENV GOMPLATE_VERSION=${GOMPLATE_VERSION}
RUN wget -O /usr/local/bin/gomplate "https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim" \
RUN wget -O /usr/local/bin/gomplate --progress=dot:giga "https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim" \
&& chmod +x /usr/local/bin/gomplate \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install docker-compose. Get versions from https://github.com/docker/compose/releases
ARG DOCKER_COMPOSE_VERSION="1.26.2"
ENV DOCKER_COMPOSE_VERSION=${DOCKER_COMPOSE_VERSION}
RUN wget -O /usr/local/bin/docker-compose "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64" \
RUN wget -O /usr/local/bin/docker-compose --progress=dot:giga "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64" \
&& chmod +x /usr/local/bin/docker-compose \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install Podman. Get available versions by running the command `dnf list podman`
ARG PODMAN_VERSION="2.2.1"
ARG PODMAN_VERSION="3.2.3"
ENV PODMAN_VERSION=${PODMAN_VERSION}
RUN dnf -y install podman-${PODMAN_VERSION} \
&& dnf clean all \
&& rm -rf /var/cache/yum/ \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install Skopeo. Get available versions by running the command `dnf list skopeo`
ARG SKOPEO_VERSION="1.2.0"
ARG SKOPEO_VERSION="1.3.1"
ENV SKOPEO_VERSION=${SKOPEO_VERSION}

# A seperate binary version needs to be set because, for some unknown reason, skopeo's package verion and binary version are different.
# This is caused by Red Hat's packaging and there isn't much we can do about it.
ARG SKOPEO_BINARY_VERSION="1.3.2"
ENV SKOPEO_BINARY_VERSION=${SKOPEO_BINARY_VERSION}

RUN dnf -y install skopeo-${SKOPEO_VERSION} \
&& dnf clean all \
&& rm -rf /var/cache/yum/ \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# hadolint ignore=DL3059
RUN useradd -ms /bin/bash anvil

USER anvil
Expand Down Expand Up @@ -183,21 +191,21 @@ RUN asdf plugin add python \
# NOTE: PIPENV_VERSION is an env var that is used by pipenv, so it can't be used here. ref: https://github.com/pypa/pipenv/issues/3633#issuecomment-478250721
ARG PIP_ENV_VERSION="2020.11.15"
ENV PIP_ENV_VERSION=${PIP_ENV_VERSION}
RUN pip install "pipenv==${PIP_ENV_VERSION}" \
RUN pip install --no-cache-dir "pipenv==${PIP_ENV_VERSION}" \
&& asdf reshim python \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install pre-commit. Get versions using 'pip install pre-commit=='
ARG PRE_COMMIT_VERSION="2.7.1"
ENV PRE_COMMIT_VERSION=${PRE_COMMIT_VERSION}
RUN pip install "pre-commit==${PRE_COMMIT_VERSION}" \
RUN pip install --no-cache-dir "pre-commit==${PRE_COMMIT_VERSION}" \
&& asdf reshim python \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install aws cli. Get versions using pip install awscli=='
ARG AWS_CLI_VERSION="1.18.108"
ENV AWS_CLI_VERSION=${AWS_CLI_VERSION}
RUN pip install "awscli==${AWS_CLI_VERSION}" \
RUN pip install --no-cache-dir "awscli==${AWS_CLI_VERSION}" \
&& asdf reshim python \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

Expand Down Expand Up @@ -306,7 +314,7 @@ RUN asdf plugin add helm-cr \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install golang. Get versions using 'asdf list all golang'
ARG GO_VERSION="1.15.6"
ARG GO_VERSION="1.16.7"
ENV GO_VERSION=${GO_VERSION}
RUN asdf plugin-add golang https://github.com/kennyp/asdf-golang.git \
&& asdf install golang "${GO_VERSION}" \
Expand All @@ -316,7 +324,7 @@ ENV GOPATH="/home/anvil/go"
ENV PATH="${PATH}:${GOPATH}/bin"

# Install golangci-lint. Get versions using asdf list all golangci-lint
ARG GOLANGCI_LINT_VERSION="1.34.1"
ARG GOLANGCI_LINT_VERSION="1.41.1"
ENV GOLANGCI_LINT_VERSION=${GOLANGCI_LINT_VERSION}
RUN asdf plugin add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git \
&& asdf install golangci-lint "${GOLANGCI_LINT_VERSION}" \
Expand Down Expand Up @@ -351,6 +359,13 @@ RUN asdf plugin-add sonarscanner https://github.com/virtualstaticvoid/asdf-sonar
&& asdf global sonarscanner "${SONARSCANNER_VERSION}" \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*

# Install serverless. Get versions from https://github.com/serverless/serverless/releases
ARG SERVERLESS_VERSION="2.54.0"
ENV SERVERLESS_VERSION=${SERVERLESS_VERSION}
RUN npm install -g serverless@${SERVERLESS_VERSION} \
&& rm -rf /var/tmp/* /tmp/* /var/tmp/.???* /tmp/.???*


# Support tools installed as anvil when running as root user
USER root
ENV ASDF_DATA_DIR="/home/anvil/.asdf"
Expand Down

0 comments on commit e7d5a57

Please sign in to comment.