From fd7401f658dfe0bb0e663d7578bc37eb9083f511 Mon Sep 17 00:00:00 2001 From: Ilona Shishov Date: Tue, 26 Sep 2023 11:50:56 +0300 Subject: [PATCH 1/3] feat: added support for golang ecosystem to alpha image Signed-off-by: Ilona Shishov --- .github/workflows/stage.yml | 4 ++-- docker-image/Dockerfiles/Dockerfile | 24 ++++++++++---------- docker-image/Dockerfiles/Dockerfile.alpha | 25 ++++++++++++++------- docker-image/README.md | 7 +++--- docker-image/configs/.npmrc | 2 +- docker-image/scripts/{exhort.sh => rhda.sh} | 0 6 files changed, 36 insertions(+), 26 deletions(-) rename docker-image/scripts/{exhort.sh => rhda.sh} (100%) diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index ace797c7..b97b479e 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -8,7 +8,7 @@ env: IMAGE_REGISTRY_USER: ${{ secrets.IMAGE_REGISTRY_USER }} IMAGE_REGISTRY_PASSWORD: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} DOCKERFILE_PATH: ./docker-image/Dockerfiles/Dockerfile.alpha - GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN: ${{ secrets.GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN }} + PACKAGE_REGISTRY_ACCESS_TOKEN: ${{ secrets.PACKAGE_REGISTRY_ACCESS_TOKEN }} on: workflow_dispatch: @@ -96,7 +96,7 @@ jobs: dockerfiles: | ${{ env.DOCKERFILE_PATH }} build-args: | - GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN=${{ env.GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN }} + PACKAGE_REGISTRY_ACCESS_TOKEN=${{ env.PACKAGE_REGISTRY_ACCESS_TOKEN }} context: docker-image - name: Push Image To Registry diff --git a/docker-image/Dockerfiles/Dockerfile b/docker-image/Dockerfiles/Dockerfile index 535c1a98..d182b280 100644 --- a/docker-image/Dockerfiles/Dockerfile +++ b/docker-image/Dockerfiles/Dockerfile @@ -5,7 +5,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-18 as builder USER root # assign token for reading packages from github package registry -ARG GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN='' +ARG PACKAGE_REGISTRY_ACCESS_TOKEN='' # install Java RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz -o /tmp/java-package.tar.gz \ @@ -15,9 +15,9 @@ RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar RUN curl -kL https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz -o /tmp/maven-package.tar.gz \ && tar xvzf /tmp/maven-package.tar.gz -C /usr/ -# install go package manager -RUN curl -kL https://go.dev/dl/go1.20.6.linux-amd64.tar.gz -o /tmp/go-package.tar.gz \ - && tar xvzf /tmp/go-package.tar.gz -C /usr/ +# install golang package manager +RUN curl -kL https://go.dev/dl/go1.21.1.linux-amd64.tar.gz -o /tmp/golang-package.tar.gz \ + && tar xvzf /tmp/golang-package.tar.gz -C /usr/ # install python package manager (pip) RUN python3 -m ensurepip --upgrade @@ -28,12 +28,12 @@ RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -o # copy the .npmrc file COPY configs/.npmrc . # replace placeholder with the actual environment variable -RUN sed -i "s/__GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN__/${GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc +RUN sed -i "s/__PACKAGE_REGISTRY_ACCESS_TOKEN__/${PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc # install Exhort javascript API RUN npm install --global @RHEcosystemAppEng/exhort-javascript-api -# add exhort script -COPY scripts/exhort.sh / +# add RHDA script +COPY scripts/rhda.sh / # assign executable permissions to all installed binaries RUN chmod +x /usr/jdk-20.0.2/bin/java \ @@ -42,7 +42,7 @@ RUN chmod +x /usr/jdk-20.0.2/bin/java \ && chmod +x /usr/local/bin/pip3 \ && chmod +x /usr/bin/jq \ && chmod +x /opt/app-root/src/.npm-global/bin/exhort-javascript-api \ - && chmod +x /exhort.sh + && chmod +x /rhda.sh # use default user USER default @@ -65,10 +65,10 @@ ENV MAVEN_HOME=/usr/apache-maven-3.9.4 # Copy golang executable from the builder stage COPY --from=builder /usr/go/ /usr/go/ -ENV GO_HOME=/usr/go +ENV GOLANG_HOME=/usr/go # Update PATH -ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GO_HOME/bin +ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GOLANG_HOME/bin # Copy python executable from the builder stage COPY --from=builder /usr/bin/python3 /usr/bin/python3 @@ -87,5 +87,5 @@ COPY --from=builder /usr/bin/jq /usr/bin/jq # Copy exhort-javascript-api executable from the builder stage COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global/ -# Copy exhort executable script from the builder stage -COPY --from=builder /exhort.sh /exhort.sh \ No newline at end of file +# Copy RHDA executable script from the builder stage +COPY --from=builder /rhda.sh /rhda.sh \ No newline at end of file diff --git a/docker-image/Dockerfiles/Dockerfile.alpha b/docker-image/Dockerfiles/Dockerfile.alpha index ce47b729..b1bcc174 100644 --- a/docker-image/Dockerfiles/Dockerfile.alpha +++ b/docker-image/Dockerfiles/Dockerfile.alpha @@ -5,7 +5,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-18 as builder USER root # assign token for reading packages from github package registry -ARG GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN='' +ARG PACKAGE_REGISTRY_ACCESS_TOKEN='' # install Java RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz -o /tmp/java-package.tar.gz \ @@ -15,25 +15,30 @@ RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar RUN curl -kL https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz -o /tmp/maven-package.tar.gz \ && tar xvzf /tmp/maven-package.tar.gz -C /usr/ +# install golang package manager +RUN curl -kL https://go.dev/dl/go1.21.1.linux-amd64.tar.gz -o /tmp/golang-package.tar.gz \ + && tar xvzf /tmp/golang-package.tar.gz -C /usr/ + # install jq JSON formating tool RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -o /usr/bin/jq # copy the .npmrc file COPY configs/.npmrc . # replace placeholder with the actual environment variable -RUN sed -i "s/__GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN__/${GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc +RUN sed -i "s/__PACKAGE_REGISTRY_ACCESS_TOKEN__/${PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc # install Exhort javascript API RUN npm install --global @RHEcosystemAppEng/exhort-javascript-api -# add exhort script -COPY scripts/exhort.sh / +# add RHDA script +COPY scripts/rhda.sh / # assign executable permissions to all installed binaries RUN chmod +x /usr/jdk-20.0.2/bin/java \ && chmod +x /usr/apache-maven-3.9.4/bin/mvn \ + && chmod +x /usr/go/bin/go \ && chmod +x /usr/bin/jq \ && chmod +x /opt/app-root/src/.npm-global/bin/exhort-javascript-api \ - && chmod +x /exhort.sh + && chmod +x /rhda.sh # use default user USER default @@ -54,8 +59,12 @@ ENV JAVA_HOME=/usr/jdk-20.0.2 COPY --from=builder /usr/apache-maven-3.9.4/ /usr/apache-maven-3.9.4/ ENV MAVEN_HOME=/usr/apache-maven-3.9.4 +# Copy golang executable from the builder stage +COPY --from=builder /usr/go/ /usr/go/ +ENV GOLANG_HOME=/usr/go + # Update PATH -ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin +ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GOLANG_HOME/bin # Copy jq executable from the builder stage COPY --from=builder /usr/bin/jq /usr/bin/jq @@ -63,5 +72,5 @@ COPY --from=builder /usr/bin/jq /usr/bin/jq # Copy exhort-javascript-api executable from the builder stage COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global/ -# Copy exhort executable script from the builder stage -COPY --from=builder /exhort.sh /exhort.sh \ No newline at end of file +# Copy RHDA executable script from the builder stage +COPY --from=builder /rhda.sh /rhda.sh \ No newline at end of file diff --git a/docker-image/README.md b/docker-image/README.md index 7b93e4b0..eac343fb 100644 --- a/docker-image/README.md +++ b/docker-image/README.md @@ -13,6 +13,7 @@ Both Docker and Podman are container runtimes that can be used to build and run ## Images generated for Exhort Javascript API -Ecosystem | Version | IMAGE | TAG | -------------- | ------------------------------------------------------------------ | ----------------------------------------------- |-------------------| -Maven & NPM | maven 3.9.4,
npm 9.5.0 | quay.io/ecosystem-appeng/exhort-javascript-api | 1.0-alpha | +Ecosystem | Version | IMAGE | TAG | +----------------------| ------------------------------------------------------------------ | ----------------------------------------------- |-------------------| +Maven & NPM | mvn 3.9.4,
npm 9.5.0 | quay.io/ecosystem-appeng/exhort-javascript-api | 0.7.0-alpha | +Maven, NPM & Golang | mvn 3.9.4,
npm 9.5.0,
go 1.21.1 | quay.io/ecosystem-appeng/exhort-javascript-api | 0.7.3-alpha | diff --git a/docker-image/configs/.npmrc b/docker-image/configs/.npmrc index 0fa63d74..a21fe966 100644 --- a/docker-image/configs/.npmrc +++ b/docker-image/configs/.npmrc @@ -1,2 +1,2 @@ -//npm.pkg.github.com/:_authToken=__GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN__ +//npm.pkg.github.com/:_authToken=__PACKAGE_REGISTRY_ACCESS_TOKEN__ @RHEcosystemAppEng:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/docker-image/scripts/exhort.sh b/docker-image/scripts/rhda.sh similarity index 100% rename from docker-image/scripts/exhort.sh rename to docker-image/scripts/rhda.sh From 95916fe81176d1eeca0da3583ebb6b0096ffc539 Mon Sep 17 00:00:00 2001 From: Ilona Shishov Date: Wed, 4 Oct 2023 12:23:47 +0300 Subject: [PATCH 2/3] feat: added support for RDHA_TOKEN Signed-off-by: Ilona Shishov --- docker-image/Dockerfiles/Dockerfile | 11 ++++++++++- docker-image/Dockerfiles/Dockerfile.alpha | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docker-image/Dockerfiles/Dockerfile b/docker-image/Dockerfiles/Dockerfile index d182b280..b99a148d 100644 --- a/docker-image/Dockerfiles/Dockerfile +++ b/docker-image/Dockerfiles/Dockerfile @@ -25,6 +25,9 @@ RUN python3 -m ensurepip --upgrade # install jq JSON formating tool RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -o /usr/bin/jq +# install linux utils Package to enable UUID generation +RUN yum install util-linux + # copy the .npmrc file COPY configs/.npmrc . # replace placeholder with the actual environment variable @@ -41,19 +44,22 @@ RUN chmod +x /usr/jdk-20.0.2/bin/java \ && chmod +x /usr/go/bin/go \ && chmod +x /usr/local/bin/pip3 \ && chmod +x /usr/bin/jq \ + && chmod +x /usr/bin/uuidgen \ && chmod +x /opt/app-root/src/.npm-global/bin/exhort-javascript-api \ && chmod +x /rhda.sh # use default user USER default -#second stage +# second stage FROM registry.access.redhat.com/ubi9/nodejs-18-minimal LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhort-javascript-api # assign token for exhort authentication with Snyk provider ENV EXHORT_SNYK_TOKEN='' +# assign rhda token for rhda user authentication with exhort +ENV RHDA_TOKEN='' # Copy java executable from the builder stage COPY --from=builder /usr/jdk-20.0.2/ /usr/jdk-20.0.2/ @@ -84,6 +90,9 @@ RUN ln -s /usr/bin/python3 /usr/bin/python \ # Copy jq executable from the builder stage COPY --from=builder /usr/bin/jq /usr/bin/jq +# Copy uuidgen executable from the builder stage +COPY --from=builder /usr/bin/uuidgen /usr/bin/uuidgen + # Copy exhort-javascript-api executable from the builder stage COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global/ diff --git a/docker-image/Dockerfiles/Dockerfile.alpha b/docker-image/Dockerfiles/Dockerfile.alpha index b1bcc174..4e0a7429 100644 --- a/docker-image/Dockerfiles/Dockerfile.alpha +++ b/docker-image/Dockerfiles/Dockerfile.alpha @@ -22,6 +22,9 @@ RUN curl -kL https://go.dev/dl/go1.21.1.linux-amd64.tar.gz -o /tmp/golang-packag # install jq JSON formating tool RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -o /usr/bin/jq +# install linux utils Package to enable UUID generation +RUN yum install util-linux + # copy the .npmrc file COPY configs/.npmrc . # replace placeholder with the actual environment variable @@ -37,19 +40,22 @@ RUN chmod +x /usr/jdk-20.0.2/bin/java \ && chmod +x /usr/apache-maven-3.9.4/bin/mvn \ && chmod +x /usr/go/bin/go \ && chmod +x /usr/bin/jq \ + && chmod +x /usr/bin/uuidgen \ && chmod +x /opt/app-root/src/.npm-global/bin/exhort-javascript-api \ && chmod +x /rhda.sh # use default user USER default -#second stage +# second stage FROM registry.access.redhat.com/ubi9/nodejs-18-minimal LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhort-javascript-api # assign token for exhort authentication with Snyk provider ENV EXHORT_SNYK_TOKEN='' +# assign rhda token for rhda user authentication with exhort +ENV RHDA_TOKEN='' # Copy java executable from the builder stage COPY --from=builder /usr/jdk-20.0.2/ /usr/jdk-20.0.2/ @@ -69,6 +75,9 @@ ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GOLANG_HOME/bin # Copy jq executable from the builder stage COPY --from=builder /usr/bin/jq /usr/bin/jq +# Copy uuidgen executable from the builder stage +COPY --from=builder /usr/bin/uuidgen /usr/bin/uuidgen + # Copy exhort-javascript-api executable from the builder stage COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global/ From bc50f60883fc87b55aa30e31997733aee8c9e278 Mon Sep 17 00:00:00 2001 From: Ilona Shishov Date: Sun, 8 Oct 2023 10:57:21 +0300 Subject: [PATCH 3/3] feat: added support for RDHA_SOURCE Signed-off-by: Ilona Shishov --- docker-image/Dockerfiles/Dockerfile | 2 ++ docker-image/Dockerfiles/Dockerfile.alpha | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docker-image/Dockerfiles/Dockerfile b/docker-image/Dockerfiles/Dockerfile index b99a148d..064923a6 100644 --- a/docker-image/Dockerfiles/Dockerfile +++ b/docker-image/Dockerfiles/Dockerfile @@ -60,6 +60,8 @@ LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhor ENV EXHORT_SNYK_TOKEN='' # assign rhda token for rhda user authentication with exhort ENV RHDA_TOKEN='' +# assign rhda source for exhort tracking purposes +ENV RHDA_SOURCE='' # Copy java executable from the builder stage COPY --from=builder /usr/jdk-20.0.2/ /usr/jdk-20.0.2/ diff --git a/docker-image/Dockerfiles/Dockerfile.alpha b/docker-image/Dockerfiles/Dockerfile.alpha index 4e0a7429..d64bf646 100644 --- a/docker-image/Dockerfiles/Dockerfile.alpha +++ b/docker-image/Dockerfiles/Dockerfile.alpha @@ -56,6 +56,8 @@ LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhor ENV EXHORT_SNYK_TOKEN='' # assign rhda token for rhda user authentication with exhort ENV RHDA_TOKEN='' +# assign rhda source for exhort tracking purposes +ENV RHDA_SOURCE='' # Copy java executable from the builder stage COPY --from=builder /usr/jdk-20.0.2/ /usr/jdk-20.0.2/