Skip to content

Commit

Permalink
Merge pull request #3 from NVIDIA/images
Browse files Browse the repository at this point in the history
Build multiple go versions
  • Loading branch information
ArangoGutierrez authored Jan 25, 2024
2 parents 0014282 + d285dd7 commit 96d8a11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.21","1.20","1.19"]
steps:
- uses: actions/checkout@v4

- name: Calculate build vars
id: vars
run: |
Expand All @@ -47,30 +49,26 @@ jobs:
else
echo "PUSH_ON_BUILD=true" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image
env:
GOLANG_VERSION: "1.21.6"
GOLANG_VERSION: ${{ matrix.go-version }}
run: |
docker build --build-arg GOLANG_VERSION=${GOLANG_VERSION} \
-f ./images/devel/Dockerfile \
--tag ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-test-infra:${COMMIT_SHORT_SHA} \
.
push:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
docker build --build-arg GOLANG_VERSION=${GOLANG_VERSION} \
-f ./images/devel/Dockerfile \
--tag ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-test-infra:devel-go${GOLANG_VERSION} \
.
- name: Push image
env:
GOLANG_VERSION: ${{ matrix.go-version }}
run: |
docker push ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-test-infra:${COMMIT_SHORT_SHA}
if [[ "${PUSH_ON_BUILD}" == "true" ]]; then
docker push ghcr.io/${LOWERCASE_REPO_OWNER}/k8s-test-infra:devel-go${GOLANG_VERSION}
fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# k8s-ci-artifacts
# k8s-test-infra
2 changes: 1 addition & 1 deletion images/devel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

ARG GOLANG_VERSION=x.x.x
ARG GOLANG_VERSION=x.x
FROM golang:${GOLANG_VERSION}

RUN go install github.com/golangci/golangci-lint/cmd/[email protected] \
Expand Down

0 comments on commit 96d8a11

Please sign in to comment.