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
16 changes: 13 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-swarm-jenkins-agent.sh', 'build-edt-swarm-agent.sh', 'build-oscript-k8s-agent.sh', 'build-oscript-swarm-agent.sh', 'build-server.sh' ]

steps:
- name: Checkout repository
Expand All @@ -25,5 +26,14 @@ 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 }}
17 changes: 12 additions & 5 deletions build-base-k8s-jenkins-agent.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -eo pipefail

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

Expand Down
17 changes: 12 additions & 5 deletions build-base-swarm-jenkins-agent.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -eo pipefail

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

Expand Down
17 changes: 12 additions & 5 deletions build-crs.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -eo pipefail

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

Expand Down
23 changes: 15 additions & 8 deletions build-edt-k8s-agent.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
#!/usr/bin/env bash
set -eo pipefail

if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
last_arg='--no-cache .'
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

edt_version=$EDT_VERSION
Expand All @@ -30,7 +37,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
21 changes: 14 additions & 7 deletions build-edt-swarm-agent.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/bash
set -e

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
#!/usr/bin/env bash
set -eo pipefail

if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
last_arg='--no-cache .'
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

edt_version=$EDT_VERSION
Expand Down
19 changes: 13 additions & 6 deletions build-oscript-k8s-agent.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -eo pipefail

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
last_arg='--no-cache .'
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

docker build \
Expand Down
19 changes: 13 additions & 6 deletions build-oscript-swarm-agent.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -eo pipefail

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
last_arg='--no-cache .'
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

docker build \
Expand Down
17 changes: 12 additions & 5 deletions build-server.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
#!/bin/bash
set -e
#!/usr/bin/env bash
set -eo pipefail

docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
if [ -n "${DOCKER_LOGIN}" ] && [ -n "${DOCKER_PASSWORD}" ] && [ -n "${DOCKER_REGISTRY_URL}" ]; then
if ! docker login -u "${DOCKER_LOGIN}" -p "${DOCKER_PASSWORD}" "${DOCKER_REGISTRY_URL}"; then
echo "Docker login failed"
exit 1
fi
else
echo "Skipping Docker login due to missing credentials"
fi

if [ $DOCKER_SYSTEM_PRUNE = 'true' ] ; then
if [ "${DOCKER_SYSTEM_PRUNE}" = 'true' ] ; then
docker system prune -af
fi

last_arg='.'
if [ $NO_CACHE = 'true' ] ; then
if [ "${NO_CACHE}" = 'true' ] ; then
last_arg='--no-cache .'
fi

Expand Down
Loading