DEVEX-20:
This commit is contained in:
parent
bfd6512a23
commit
ac34a5e469
@ -22,102 +22,14 @@ jobs:
|
|||||||
name: 'Deploy to dev'
|
name: 'Deploy to dev'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: 'Cloning'
|
- name: Cloning2
|
||||||
env:
|
uses: https://git.binom.pw/otp/devops/clone@main
|
||||||
SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
with:
|
||||||
REPO_PATH: ${{ github.event.inputs.repo_path }}
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
BRANCH: ${{ github.event.inputs.branch }}
|
repository: ${{ github.event.inputs.repo_path }}
|
||||||
run: |
|
branch: ${{ github.event.inputs.branch }}
|
||||||
echo "Container ID: $(cat /proc/1/cgroup | grep docker)"
|
- uses: https://git.binom.pw/otp/devops/config-gradle@main
|
||||||
echo "Inside Docker: $(docker info >/dev/null 2>&1 && echo yes || echo no)"
|
- uses: https://git.binom.pw/otp/devops/setup-gradle@main
|
||||||
pwd
|
|
||||||
mkdir -p ~/.gradle
|
|
||||||
mkdir -p ~/.ssh
|
|
||||||
ls -la ~/.ssh/ || echo "No .ssh dir"
|
|
||||||
echo "$SSH_KEY" > ~/.ssh/my_key
|
|
||||||
cat > ~/.ssh/config << 'EOF'
|
|
||||||
Host bitbucket.isb
|
|
||||||
HostName bitbucket.isb
|
|
||||||
User git
|
|
||||||
IdentityFile ~/.ssh/my_key
|
|
||||||
ProxyCommand socat - PROXY:192.168.76.142:%h:%p,proxyport=8077
|
|
||||||
StrictHostKeyChecking no
|
|
||||||
UserKnownHostsFile /dev/null
|
|
||||||
IdentitiesOnly yes
|
|
||||||
EOF
|
|
||||||
chmod 600 ~/.ssh/config
|
|
||||||
chmod 600 ~/.ssh/my_key
|
|
||||||
GIT_TERMINAL_PROMPT=0 git clone --single-branch --branch $BRANCH "ssh://git@bitbucket.isb:443/$REPO_PATH.git" .
|
|
||||||
cat > ~/.gradle/init.gradle.kts << 'EOF'
|
|
||||||
import java.net.URI
|
|
||||||
|
|
||||||
val OTP_REPO_PREFIX = "https://nexus.isb/repository/"
|
|
||||||
val MAVEN_CENTRAL = "https://repo.maven.apache.org/maven2/"
|
|
||||||
val GRADLE_PLUGIN_REPOSITORY = "https://plugins.gradle.org/m2/"
|
|
||||||
|
|
||||||
fun replaceRepository(repo: ArtifactRepository) {
|
|
||||||
if (repo !is MavenArtifactRepository) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val sourceUrl = repo.url
|
|
||||||
when {
|
|
||||||
repo.url == URI("${OTP_REPO_PREFIX}central-mvn-proxy/") -> repo.url = URI(MAVEN_CENTRAL)
|
|
||||||
repo.url == URI("${OTP_REPO_PREFIX}pluginsgradle-mvn-proxy/") ->
|
|
||||||
repo.url = URI(GRADLE_PLUGIN_REPOSITORY)
|
|
||||||
repo.url.toString().startsWith(OTP_REPO_PREFIX) -> {
|
|
||||||
repo.url =
|
|
||||||
URI(
|
|
||||||
"http://192.168.76.117/repository/${repo.url.toString().removePrefix(OTP_REPO_PREFIX)}"
|
|
||||||
)
|
|
||||||
repo.isAllowInsecureProtocol = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sourceUrl != repo.url) {
|
|
||||||
repo.isAllowInsecureProtocol = true
|
|
||||||
repo.credentials.username = ""
|
|
||||||
repo.credentials.password = ""
|
|
||||||
println("$sourceUrl => ${repo.url}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val LOCAL_REPOSITORY = "file:/home/${System.getProperty("user.name")}/.m2/repository/"
|
|
||||||
|
|
||||||
gradle.settingsEvaluated {
|
|
||||||
pluginManagement
|
|
||||||
.repositories
|
|
||||||
.filterIsInstance<MavenArtifactRepository>()
|
|
||||||
.filter {
|
|
||||||
it.url == URI("https://nexus.isb/repository/pluginsgradle-mvn-proxy/") ||
|
|
||||||
it.url == URI("http://repo.xx/otp-pluginsgradle-mvn-proxy/")
|
|
||||||
}
|
|
||||||
.forEach {
|
|
||||||
pluginManagement.repositories.remove(it)
|
|
||||||
pluginManagement.repositories.add(0, it)
|
|
||||||
}
|
|
||||||
|
|
||||||
pluginManagement
|
|
||||||
.repositories
|
|
||||||
.filterIsInstance<MavenArtifactRepository>()
|
|
||||||
.filter { it.url == URI(LOCAL_REPOSITORY) }
|
|
||||||
.forEach {
|
|
||||||
pluginManagement.repositories.remove(it)
|
|
||||||
pluginManagement.repositories.add(0, it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gradle.beforeSettings {
|
|
||||||
pluginManagement.repositories.configureEach { replaceRepository(this) }
|
|
||||||
dependencyResolutionManagement.repositories.configureEach { replaceRepository(this) }
|
|
||||||
allprojects {
|
|
||||||
repositories.configureEach { replaceRepository(this) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
ls
|
|
||||||
sed -i 's|distributionUrl=https://nexus.isb/repository/gradleorg-raw-proxy|distributionUrl=https://services.gradle.org/distributions|g' ./gradle/wrapper/gradle-wrapper.properties
|
|
||||||
cat ./gradle/wrapper/gradle-wrapper.properties
|
|
||||||
cat ~/.gradle/init.gradle.kts
|
|
||||||
chmod +x ./gradlew
|
|
||||||
- name: Setup Jvm
|
- name: Setup Jvm
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
@ -126,11 +38,3 @@ jobs:
|
|||||||
- name: Building
|
- name: Building
|
||||||
run: |
|
run: |
|
||||||
./gradlew classes --no-daemon -x cyclonedxBom
|
./gradlew classes --no-daemon -x cyclonedxBom
|
||||||
- name: Cleanup temp files
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
echo "🧹 Очистка временных файлов..."
|
|
||||||
rm -rf ~/.ssh/config
|
|
||||||
rm -rf ~/.ssh/my_key
|
|
||||||
rm -rf ~/.gradle/init.gradle.kts
|
|
||||||
echo "✅ Cleanup completed"
|
|
||||||
Loading…
x
Reference in New Issue
Block a user