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

Сборка образов 1с #45

Merged
merged 13 commits into from
Oct 1, 2024
17 changes: 14 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
strategy:
fail-fast: false
matrix:
dir: [ 'jdk', 'oscript' ]
script: [ 'build-base-k8s-jenkins-agent.sh', 'build-base-k8s-jenkins-agent.sh', 'build-edt-k8s-agent.sh', 'build-edt-swarm-agent.sh', 'build-oscript-k8s-agent.sh', 'build-oscript-swarm-agent.sh', 'build-server.sh' ]
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved

steps:
- name: Checkout repository
Expand All @@ -25,5 +26,15 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Build Docker images
env:
DOCKER_REGISTRY_URL: 'localhost:5000'
DOCKER_LOGIN: ""
DOCKER_PASSWORD: ""
ONEC_USERNAME: ${{ secrets.ONEC_USERNAME}}
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD}}
ONEC_VERSION: '8.3.24.1624'
EDT_VERSION: '2023.3.6'
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
run: |
docker build -t oscript:latest -f ${{ matrix.dir }}/Dockerfile .
docker run -d -p 5000:5000 --name registry registry:2
./${{ matrix.script }}

nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion build-base-k8s-jenkins-agent.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
4 changes: 3 additions & 1 deletion build-base-swarm-jenkins-agent.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
4 changes: 3 additions & 1 deletion build-crs.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

nixel2007 marked this conversation as resolved.
Show resolved Hide resolved
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Improve security of Docker login

Passing the Docker password directly in the command line can be a security risk as it may be visible in process lists or logs.

Consider using Docker's built-in credential helpers or passing the password through stdin. Here's an example using stdin:

echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_LOGIN}" --password-stdin "${DOCKER_REGISTRY_URL}"

This method is more secure as it doesn't expose the password in the command line.

fi
nixel2007 marked this conversation as resolved.
Show resolved Hide resolved

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
6 changes: 4 additions & 2 deletions build-edt-k8s-agent.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down Expand Up @@ -30,7 +32,7 @@ docker build \
--build-arg ONEC_USERNAME=$ONEC_USERNAME \
--build-arg ONEC_PASSWORD=$ONEC_PASSWORD \
--build-arg EDT_VERSION="$EDT_VERSION" \
--build-arg DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL \
--build-arg DOWNLOADER_REGISTRY_URL=$DOCKER_REGISTRY_URL \
--build-arg DOWNLOADER_IMAGE=oscript-downloader \
--build-arg DOWNLOADER_TAG=latest \
-t $DOCKER_REGISTRY_URL/edt:$edt_escaped \
Expand Down
4 changes: 3 additions & 1 deletion build-edt-swarm-agent.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
4 changes: 3 additions & 1 deletion build-oscript-k8s-agent.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
4 changes: 3 additions & 1 deletion build-oscript-swarm-agent.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
4 changes: 3 additions & 1 deletion build-server.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ $DOCKER_LOGIN != '' ] ; then
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
docker system prune -af
Expand Down
Loading