diff --git a/.github/workflows/bashate_and_shellcheck.yaml b/.github/workflows/bashate_and_shellcheck.yaml deleted file mode 100644 index 5fcec19..0000000 --- a/.github/workflows/bashate_and_shellcheck.yaml +++ /dev/null @@ -1,29 +0,0 @@ -name: Lint Bash Scripts -on: - push: - branches: - - '*' - -jobs: - lint: - name: Run Bashate and ShellCheck - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build tool - run: | - make build # Creates the ./bin directory required by shellcheck afterwards - shell: bash - - - name: Run ShellCheck - run: | - make shellcheck # Execute the shellcheck target in the Makefile - shell: bash - - - name: Run Bashate - run: | - make bashate # Execute the bashate target in the Makefile - shell: bash diff --git a/.github/workflows/pull_request_workflow.yml b/.github/workflows/pull_request_workflow.yml new file mode 100644 index 0000000..e7a742a --- /dev/null +++ b/.github/workflows/pull_request_workflow.yml @@ -0,0 +1,32 @@ +name: Pull Request Workflow + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + + +jobs: + + lint_bash: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: make build # Build Imager tool + - run: make shellcheck # Run ShellCheck + - run: make bashate # Run Bashate + + lint_golang: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: "stable" + - uses: golangci/golangci-lint-action@v3 + with: + version: "latest" +# - run: make generate diff --git a/.github/workflows/vulncheck_periodic.yaml b/.github/workflows/vulncheck_periodic.yml similarity index 100% rename from .github/workflows/vulncheck_periodic.yaml rename to .github/workflows/vulncheck_periodic.yml diff --git a/Dockerfile b/Dockerfile index 2f10505..5771769 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ WORKDIR /workspace COPY go.mod go.sum ./ COPY vendor/ vendor/ -# Copy the go source +# Copy the Go source installation_configuration_files COPY main.go main.go COPY cmd/ cmd/ COPY internal/ internal/ @@ -24,7 +24,7 @@ RUN curl -sL https://github.com/kubernetes-sigs/cri-tools/releases/download/$CRI ########### Runtime ########## -FROM registry.ci.openshift.org/ocp/4.13:tools +FROM registry.access.redhat.com/ubi9/ubi:latest WORKDIR / @@ -32,4 +32,8 @@ COPY --from=builder /workspace/ibu-imager . COPY --from=builder /workspace/crictl /usr/bin/ COPY installation_configuration_files/ installation_configuration_files/ +RUN yum -y install jq && \ + yum clean all && \ + rm -rf /var/cache/yum + ENTRYPOINT ["./ibu-imager"] diff --git a/README.md b/README.md index bd0d2dc..fb3e2b9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # IBU Imager -[![Lint Bash Scripts](https://github.com/leo8a/ibu-imager/actions/workflows/bashate_and_shellcheck.yaml/badge.svg)](https://github.com/leo8a/ibu-imager/actions/workflows/bashate_and_shellcheck.yaml) +[![Pull Request Workflow](https://github.com/leo8a/ibu-imager/actions/workflows/pull_request_workflow.yml/badge.svg)](https://github.com/leo8a/ibu-imager/actions/workflows/pull_request_workflow.yml) This application will assist users to easily create an OCI seed image for the Image-Based Upgrade (IBU) workflow, using a simple CLI. diff --git a/dev.Dockerfile b/dev.Dockerfile deleted file mode 100644 index 6b9e24a..0000000 --- a/dev.Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -########## Builder ########## -FROM registry.hub.docker.com/library/golang:1.19 AS builder - -ENV CRIO_VERSION="v1.28.0" - -# Set workring directory -WORKDIR /workspace - -# Copy the Go Modules installation_configuration_files -COPY go.mod go.sum ./ -COPY vendor/ vendor/ - -# Copy the go source -COPY main.go main.go -COPY cmd/ cmd/ -COPY internal/ internal/ - -# Build the binary -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -mod=vendor -a -o ibu-imager main.go - -# Download crio CLI -RUN curl -sL https://github.com/kubernetes-sigs/cri-tools/releases/download/$CRIO_VERSION/crictl-$CRIO_VERSION-linux-amd64.tar.gz \ - | tar xvzf - -C . && chmod +x ./crictl - - -########### Runtime ########## -FROM registry.access.redhat.com/ubi9/ubi:latest - -WORKDIR / - -COPY --from=builder /workspace/ibu-imager . -COPY --from=builder /workspace/crictl /usr/bin/ -COPY installation_configuration_files/ installation_configuration_files/ - - -RUN yum -y install jq && \ - yum clean all && \ - rm -rf /var/cache/yum - -ENTRYPOINT ["./ibu-imager"] diff --git a/hack/clean.sh b/hack/clean.sh index 5b59ab2..47317b8 100755 --- a/hack/clean.sh +++ b/hack/clean.sh @@ -1,15 +1,13 @@ #!/bin/bash sudo rm -rf /var/tmp/container_list.done \ - /var/tmp/backup && \ + /var/tmp/backup && \ sudo rm -f /usr/local/bin/prepare-installation-configuration.sh \ - /usr/local/bin/installation-configuration.sh && \ + /usr/local/bin/installation-configuration.sh && \ sudo systemctl disable installation-configuration.service && \ sudo systemctl disable prepare-installation-configuration.service && \ rm -f /etc/systemd/system/installation-configuration.service \ - /etc/systemd/system/prepare-installation-configuration.service && \ + /etc/systemd/system/prepare-installation-configuration.service && \ sudo podman rmi quay.io/alosadag/ibu-seed-sno0:oneimage --force && \ sudo systemctl enable --now kubelet && \ -sudo systemctl enable --now crio - - + sudo systemctl enable --now crio