1. 사용 shell 확인

 echo $SHELL
/bin/zsh
  • bash이면, ~/.bash_profile 또는 ~/.bashrc에 환경변수 등록.
  • zsh이면, ~/.zshenv 또는 ~/.zshrc에 환경변수 등록.
vi ~/.bash_profile

 

vi 편집기를 처음 실행되면 읽기모드로 실행되므로 키보드의 i 를 눌러 INSERT 모드로 변환한 후 다음을 입력한다. 

JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export PATH

 

esc 를 눌러 vi 편집기를 다시 읽기모드로 나온다. (최하단의 -- INSERT -- 가 사라진다)

읽기 모드에서 shift + ; 를 눌러 나가기 모드로 전환한다. (최하단에 : 가 생긴다)

wq! 를 입력해준다.

(w:저장하기, q:나가기, wq:저장 후 나가기)

 

vi 편집기로 입력한 환경변수 값을 적용

vi 편집기로 환경변수 값을 저장한 후 source 명령어를 이용해 적용한다.

source .bash_profile 을 입력

 

환경변수 설정 확인

이제 환경변수 설정이 되었는지 확인한다.

echo $JAVA_HOME

 

java -version 을 입력하여 자바 버전을 확인한다

'IT' 카테고리의 다른 글

wsl2 윈도우10 에서 GUI 적용하기  (0) 2022.04.27
webrtc 리눅스 빌드 참고 (wsl)  (0) 2022.04.25
윈도우 젠킨스 설정  (0) 2022.02.24
젠킨스 + bitbucket + fastlane  (0) 2022.02.23
windows WSL-Ubuntu에 Jenkins 설치  (0) 2022.02.23

 

 

드디어 줄즈 에어를 구입했어요!!!
핸들링도 부드러워 마음에 들어요!!

무엇보다 접히는게 너무쉽고!!

접으면 들기도 쉽고 작아져서 트렁크에속 들어가욧!
이제 날씨 더 좋아지면 매일 에어와 함께 외출하려구요!!
#줄즈#에어플러스#유모차#유모차추천#내돈내산#에어#myjoolz#joolz#myjoolz_korea#myjoolz_korea

참고 사이트

https://docs.microsoft.com/ko-kr/windows/wsl/tutorials/gui-apps

 

WSL을 사용하여 Linux GUI 앱 실행

WSL에서 Linux GUI 앱 실행을 지원하는 방법을 알아봅니다.

docs.microsoft.com

https://psychoria.tistory.com/739

 

Windows 10 WSL 2에서 리눅스 GUI 프로그램 실행하기

Windows 10 2004 업데이트에 WSL 2(Windows Subsystem for Linux 2)이 포함되었습니다. WSL 2를 설치하는 방법은 아래 링크에서 확인 가능합니다. 2020/07/07 - [Windows/Tip&Tech] - Windows 10 2004에서 WSL 2..

psychoria.tistory.com

 

 

설정 과정중에 hashrc 설정을 해도 GUI 적용안될수 있음.

하라는데로 해서 gedit 호출했는데 UI가 안뜸.

같은 문제가있어 확인

 

https://stackoverflow.com/questions/61860208/wsl-2-run-graphical-linux-desktop-applications-from-windows-10-bash-shell-erro

 

WSL 2: Run Graphical Linux Desktop Applications from Windows 10 Bash Shell "Error E233: cannot open display"

How to run graphical Linux desktop applications from Windows 10’s Bash Shell? First, I installed Windows Subsystem for Linux (WSL) following steps as shown in here as follows: (1) Installed Windo...

stackoverflow.com

 

 

해당 답변대로 적용하니 동작함.

 

WSL2에 대한 DISPLAY 변수 설정

nameserverMicrosoft 설명서 에 따라 /etc/resolv.conf파일 에서 DISPLAY 변수를 확인하도록 설정할 수 있습니다 . ( @fqquiner  @VPraharsha는 이미 이것을 언급했습니다)

export DISPLAY=$(grep nameserver /etc/resolv.conf | awk '{print $2}'):0.0

그러나 WiFi 연결 및 여러 가상 네트워크가 있는 노트북을 사용하기 때문에 이 솔루션을 사용하는 데 문제가 있었습니다. 기존 솔루션 대신 route.exe기본 게이트웨이에서 사용하는 인터페이스를 확인하여 Windows IP 주소를 확인합니다.

 

난이걸로해결이 된듯 하다 

$ sudo vim ~/.bashrc

$ i    (수정)

esc    (뷰모드로)

$ :w   (저장)

$ :q   (나가기)

export DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0

 

DISPLAY 변수 설정.profile

sudo vim ~/.profile

# set DISPLAY to use X terminal in WSL
# in WSL2 the localhost and network interfaces are not the same than windows
if grep -q WSL2 /proc/version; then
    # execute route.exe in the windows to determine its IP address
    DISPLAY=$(route.exe print | grep 0.0.0.0 | head -1 | awk '{print $4}'):0.0

else
    # In WSL1 the DISPLAY can be the localhost address
    if grep -q icrosoft /proc/version; then
        DISPLAY=127.0.0.1:0.0
    fi

fi

윈도우 터미널 에서 wsl 종료

wsl --shutdown

 

아래의 방화벽설정도 꼭필요하다.

 

27

Had the same problem so I tried these other suggestions but what ended up working was allowing vcxsrv through the public firewall. I know you're not using vcxsrv but perhaps it's the same problem for you too.

Install VcXsrv then enable public firewall like these pictures. Open Windows Defender Firewall with Advanced Security using wf.msc at command prompt. Then allow connections like in these pictures.

VcXsrv를 설치한 다음 이 그림과 같이 공용 방화벽을 활성화합니다. 명령 프롬프트에서 wf.msc를 사용하여 고급 보안이 포함된 Windows Defender 방화벽을 엽니다. 그런 다음 이 그림과 같은 연결을 허용합니다.

[

Then run VcXsrv from this guide for Windows 10 WSL2

Run VcXsrv by adding -ac addition parameter or type this at command prompt "C:\Program Files\VcXsrv\vcxsrv.exe" :0 -multiwindow -clipboard -wgl -ac

Then type this into your WSL2 terminal

 

그런 다음 Windows 10 WSL2용 이 가이드에서 VcXsrv를 실행합니다.

-ac 추가 매개변수를 추가하여 VcXsrv를 실행하거나 명령 프롬프트 "C:\Program Files\VcXsrv\vcxsrv.exe"에 입력하십시오. :0 -multiwindow -clipboard -wgl -ac  (<-난 이부분은 적용안함 밑의 터미널 입력만 하니 적용됨)

그런 다음 이것을 WSL2 터미널에 입력하십시오.

export DISPLAY_NUMBER="0.0"
export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):$DISPLAY_NUMBER
export LIBGL_ALWAYS_INDIRECT=1
# OPTIONAL Set the keyboard layout to US
setxkbmap -layout us
setsid emacs
exit
 

맥에서는 빌드가 잘안된다.

환경변수 등록 안해도 fetch가 안먹힌다.

하지만  [git 에서 CRLF 개행 문자 차이로 인한 문제 해결하기]

$ git config --global core.autocrlf false

이것으로 해결.

하지만..진행 중에 아래의 명령에서 또 난관...

$ ./build/install-build-deps.sh

 

ERROR: lsb_release not found in $PATH

try: sudo apt-get install lsb-release

 

찾아보니 lsb_release 명령어는 리눅스에있단다..

음.. 포기하고 리눅스로 우선 해보자

 

 

리눅스 빌드하신분 링크를 참고로 한다.

https://msm8994.tistory.com/47

 

[Ubuntu] WebRTC 안드로이드용 라이브러리 컴파일

WebRTC는 영상 통화에 쓰이는 로열티프리 공개 웹 기술입니다. 구글, 모질라, 오페라 등이 지원하는 프로젝트인데 크롬, 파이어폭스, 오페라, 안드로이드, iOS용 코드가 제공됩니다. 오늘은 WebRTC

msm8994.tistory.com

 순조롭게 잘되었으나 마지막 닌자 빌드에서 소스코드가 버전이랑 머가 안맞는지 fail~~~

버전 잘 맞춰보면 될듯하다.

 

 

 

[wsl 으로 빌드 해본다]

sudo apt update

apt install curl vim git wget pkg-config unzip openjdk-8-jdk python python3 -y

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
vim ~/.bashrc

 

환경변수 추가

export PATH=$PATH:/프롬프트가/있던/폴더의/depot_tools

 

mkdir source 

cd source

 

fetch --nohooks webrtc_android

cd src

git checkout -b m94 refs/remotes/branch-heads/4606

gclient sync

./build/install-build-deps.sh

 

쭉쭉되다가 에러나는경우가 있음

Release file for http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease is not valid yet (invalid for another 3min 39s). Updates for this repository will not be applied.

날짜 시간이 잘못된오류란다.

이 명령은 잘못된 날짜 및 시간을 보고합니다. 나는 다음을 사용했다.date

sudo apt install ntp 
sudo service ntp restart 
sudo apt update

해결~

다시스트립트실행

./build/install-build-deps.sh

환경 구성

source ./build/android/envsetup.sh

 

gn gen out/arm --args='target_os="android" target_cpu="arm"'

ninja -C out/arm

 

out폴더에 결과물이 나옴.

 

aar로 빌드 . gn gen out/arm --args='target_os="android" target_cpu="arm"' 대신에

tools_webrtc/android/build_aar.py --build-dir ./out/ --arch armeabi-v7a arm64-v8a --extra-gn-args 'is_java_debug=false is_debug=false is_clang=true rtc_include_tests=false rtc_use_h264=true is_component_build=false use_rtti=true use_custom_libcxx=false treat_warnings_as_errors=false rtc_enable_protobuf=false'

 

파일확인

out/arm64-v8a/obj/libwebrtc.a 

{package}/libwebrc.a

젠킨스 설치 및 셋팅 이후 --->>>>>>

 

[참고]

https://riptutorial.com/android/example/25493/step-by-step-approach-to-set-up-jenkins-for-android

 

Install Android SDK

sudo apt update && sudo apt install android-sdk
sudo apt-get install android-sdk

Export environmental variables

export ANDROID_HOME="/usr/lib/android-sdk/"
export PATH="${PATH}:${ANDROID_HOME}tools/:${ANDROID_HOME}platform-tools/"
 
jenkins관리 -> System Configuration -> 시스템설정 -> Global properties -> Environment variables
 
등록 : ANDROID_HOME , /usr/lib/android-sdk/

 

 

 

# install unzip if not installed yet
sudo apt install unzip

# get latest sdk tools - link will change. go to https://developer.android.com/studio/#downloads to get the latest one
cd ~
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip

# unpack archive
unzip sdk-tools-linux-4333796.zip

rm sdk-tools-linux-4333796.zip

mkdir android-sdk
mv tools android-sdk/tools
sudo mv tools /usr/lib/android-sdk/tools
 
 
JAVA 설치

아래 명령어는 현재 default로 설정된 자바를 설치합니다

 

 

$ sudo apt-get install default-jdk


#만약 여러 종류의 JAVA가 설치되어 있다면, 아래 명령을 통해 Default JAVA를 선택할 수 있습니다.
sudo update-alternatives --config java



######JAVA 환경변수 지정

# /usr/lib/jvm/java-8-openjdk-amd64 라는 Path를 확인하여, environment 에 아래와 같이 추가해줍니다.
$ sudo nano /etc/environment

JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"

#저장을 하고 나서, 아래 명령어로 적용을 해주면 됩니다.
$ source /etc/environment

$ echo $JAVA_HOME

 

 

jenkins관리 -> System Configuration -> 시스템설정 -> Global properties -> Environment variables
등록 : JAVA_HOME, /usr/lib/jvm/java-8-openjdk-amd64

wsl + 젠킨스 조합이  빌드가 안된다...

윈도우에 젠킨스를 설치 하여 사용해본다...

 

깃연결하고 받아서 빌드 하려고 하니 

sh 관련 오류가 발생...

 

이것은 Jenkins가 셸 경로를 인식하지 못하기 때문에 발생합니다.
Jenkins 관리 -> 시스템 구성 -> 셸에서 셸 경로를 다음과 같이 설정합니다.

C:\Windows\system32\cmd.exe



윈도우 젠킨스 + 안드로이드 빌드
[참고]
https://medium.com/simform-engineering/getting-started-with-jenkins-android-1138ee3d1e99


Getting Started with Jenkins + Android

Jenkins with Android (Created in XD)

Originally published at:

Everything seems difficult until it is done!! I have been exploring Jenkins for a while now. When I started I didn’t know that I would face difficulty in doing the basic setup of Jenkins for building an Android project. Fortunately, I was able to make my way out after toiling for almost a week. Though Jenkins is easy to set up, it is not that easy when used for building Android Project. If you are also facing some problem, then read my post below to avoid difficulty in the setup of Jenkins for building Android project. Let us start with brief introduction of Jenkins.

Jenkins is an open source automation server. With Jenkins, organizations can accelerate the software development process by automating it. Jenkins manages and controls software delivery processes throughout the entire lifecycle, including build, document, test, package, stage, deployment, static code analysis and much more. — Cloud bees

As this is a basic setup tutorial for Jenkins + Android, I’m not going to explain what is Jenkins and how to play around it or How to configure advance setup for Android and other stuff! There are huge amount of YouTube videos and free courses out there on Jenkins! Go and check them out first if you don’t know your way around Jenkins! This tutorial is only intended to demonstrate basic Jenkins setup for Android Projects!

Here are the steps that we are going to follow:

Steps

  1. Jenkins Installation.
  2. Setting up Jenkins.
  3. Configure Jenkins for Android.
  4. Configure an Android project in Jenkins.
  5. Build Android project.
  6. Archiving Artifacts(APKs).
 

1. Jenkins Installation

Jenkins installation is pretty much straight forward for both Windows and Mac! First we need to download Jenkins from below link.

Download Jenkins

Download appropriate file for Windows/MacOs from the link. For Windows, it will be a zip file that contains a .msi installation file. For mac, it would be a .pkg file that will install Jenkins on MacOs.

Bonus

You can also download Generic Java package (.war) and run it from command line/terminal. Following command will run Jenkins from .war file. Make sure that java is installed properly.

java -jar jenkins.war
 

2. Setting up Jenkins

After installation is done, a webpage running on local host will be opened automatically like this:

If it doesn’t open automatically then you can hit this URL: http://localhost:8080

Unlock Jenkins

By default Jenkins is locked and it requires an unlock key that is written in a file named initialAdminPassword which is stored at the red highlighted path. The path would be:

For windows:

C:\Program Files (x86)\Jenkins\secrets\initialAdminPassword

For Mac:

/Users/Shared/Jenkins/Home/secrets/initialAdminPassword

Open the specified file highlighted in the page in a text editor, copy the unlock key and paste it on the page and click continue.

Unlock key

After that, a new page will be open titled “Customize Jenkins” as shown below. We will go with the “Install suggested plugins” option as it will install basic plugins like git, subversion, gradle, etc.

Customize Jenkins

After selecting Install suggested plugins, an installation page will show up that would contain list of plugins which are being installed as shown below:

Plugins Installation

Wait for all the plugins to be installed. It will take a few minutes! After the installation is completed, it will ask to create First Admin User as shown below:

Create First Admin User

Fill the required information and click on Save and Continue.

Remember, this username and password will be used to login into Jenkins.

After that, Instance configuration page will show up as shown below:

Instance configuration

You can change the default Jenkins URL if you want to. I’ll be using the default one. Click on save and finish to finish the setup. Click on Start Using Jenkins and Jenkins Dashboard will be displayed as shown below:

Jenkins Dashboard
 

3. Configure Jenkins for Android

Now, this is the tough part! To build Android project in Jenkins, a couple of things are needed as listed below:

  • Git
  • JDK
  • Gradle
  • Android SDK Tools

As we have chosen to install default plugins, git and gradle plugins are installed by default! We need to install Java and Android SDK Tools.

Setting up JDK

You can download and install java-jdk from here for respective platforms and install it. Java is very easy to install indeed! After JDK is installed, we need to set environment variables for JDK path in Jenkins. The path would be:

<installation_path>/jdk<version>/

To set environment variables for Jenkins, open Jenkins dashboard and navigate to Manage Jenkins>Configure System. Find Global Settings section and tick Environment variables checkbox to enable it.

Jenkins Global properties

Click on Add button to add an environment variable. set JDK path as shown below:

Jenkins Environment Variables

After that, scroll to bottom and click on save.

Setting up Android SDK Tools

If you already have Android SDK installed then you can skip this part and set environment variable for ANDROID_HOME pointing to Android SDK same way we set up environment variable for JDK.

If you don’t have Android SDK tools then you can download it from here. Download zip file for respective platform and unzip it at your suitable location on the disk.

Android SDK tools

Now that Android SDK tools is downloaded, we need to accept all the licenses to use it. open terminal or CMD and navigate to the unzipped folder(named “tools”) and then navigate to bin directory. First we will update sdkmanager.

For windows:

// updates sdkmanager
sdkmanager --update

For Mac:

// updates sdkmanager
./sdkmanager --update

Now we need to accept all the licenses. run following command.

For windows

// updates sdkmanager
sdkmanager --licenses

For Mac

// updates sdkmanager
./sdkmanager --licenses
sdkmanager licenses

It will show output like above image. enter “y” and press enter. It will then ask to accept licenses one by one. all we need to do is enter “y” and press enter until all the licenses are not accepted and the following message is not displayed.

licenses accepted

If you miss to accept any license then you can run the command and repeat the process. If all the licenses are accepted then running the same command will indicate that all the licenses are accepted!

That’s it! There’s no need to download build tools and platform tools as Gradle 3.0.0 and above does it for you. However if it doesn’t work for you then you can find sdkmanager commands here to download required tools and platforms.

Now that Android SDK Tools are set up, we need to set environment variable ANDROID_HOME pointing to our Android SDK location. The process is same as we did to setup environment variable for JDK.

Open Jenkins dashboard and navigate to Manage Jenkins>Configure System. Under Global Settings section add new environment variable as shown below:

ANDROID_HOME environment variable in Jenkins

Scroll to bottom and click on save.

 

4. Configure an Android project in Jenkins

Now that we have set up Jenkins for Android, our next step would be to create a new job to build our Android project. Open Jenkins dashboard and click on create new job or new item. It will the following page.

Jenkins Job Style

Enter proper project name and select Freestyle Project style. click on OK button to continue.

In the next page, click on Source Code Management tab. Here, we will setup our git repository on which we want to perform build operation. Select git option under this section, copy and paste repository URL. It will show something like this if the repository is private:

Jenkins Job Configuration

In case of public repository, we don’t need to give credentials to access the repository and you won’t get this error but if the repository is private then we must need to provide correct credentials.

Click on Add button under Credentials section and then select Jenkins credentials Provider to add new credentials. Add required information as shown below:

Jenkins Credentials Provider

Click on Add and then select the added credentials from the drop down under Credentials section. Those errors should be gone now. After that, we need to specify on which branch we want to build our project.

Jenkins Source Code Management

Jenkins will use these settings and clone repository every time we build our project. We are not setting Build Triggers and Build Environment for now for the sake of simplicity.

So far we set up how to get source code. Now we need to tell Jenkins how to build our project. Navigate to Build section, click on Add build step button. There are two ways we can configure build process for Android.

  1. Execute Shell script/ Windows batch command
  2. Invoke Gradle script

First way is used for advanced configuration. We will go with second way: by invoking Gradle script to build our project.

There are two ways we can invoke Gradle script as you can see:

  1. Invoke Gradle Script
  2. Use Gradle Wrapper

Invoke Gradle Script

By selecting this option, Jenkins will use Gradle installed on host machine to build our project. For this, we need to tell Jenkins which Gradle version to use to build project. Make sure Gradle is installed on your computer and require paths has been set in environment variables.

By default other versions are not available. Default means the latest version. To avail other versions open Jenkins dashboard and navigate to Manage Jenkins>Global Tool configuration. Head to Gradle section and click on Add button. Give a name of your choice and select a Gradle version of your choice as shown below. After that click on save. Now other created version will be available for our job.

Jenkins Gradle Installations

Use Gradle Wrapper

A better option is to use Gradle wrapper specified in the project source. As we are using the same Gradle version that was used to build project locally in Android studio, it is less error prone as there might be some compatibility issues with other versions. we are going to use this option for our project.

Make sure to check “Make Gradle executable” option. For this option we require Gradle wrapper location. You can find the wrapper into your project directory which is inside the workspace of Jenkins. We will provide it as shown below:

Remember, project root is referred by ${workspace} variable in Jenkins.

Jenkins - Use Gradle Wrapper

After that, we need to tell Jenkins which Gradle task we want to execute. Here, we want build our project and generate APK so we will first clean project and then build it. Therefor, clean build command is added. However you can add any Gradle task here to execute like: assembleDebug. the option — stacktrace is added so that we can see the stack trace of build process if something goes wrong and it fails to build.

Bonus

If you’re facing problem like this or similar (something to do with file not found which is autogenerated file):

C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-1.1.0-alpha04.aar\3ffce2b6cda8e1064645b95c35c5d11a\res\layout\abc_action_bar_up_container.xml: error: file not found.

This is the problem of Gradle caches and user permissions. The best way to handle this and ensure that it will not happen in future builds is to use custom Gradle cache directory.

Create a directory (e.g. gradle_home) somewhere other than the private directories for a user or restricted directories.(e.g. for windows, other than C drive).

After that, we need to add an environment variable to tell gradle which directory to use for its caches. copy the directory path the we just created and open Jenkins dashboard. Navigate to Manage Jenkins> Configure System. Under the Global properties section add another environment variable named GRADLE_USER_HOME as shown below.

GRADLE_USER_HOME environment variable in Jenkins

Click on save and the setup is done!

 

5. Build Android Project

To trigger build, open Jenkins dashboard and select the project/job. On the project/job dashboard, click on Build Now option on the left side panel. After that, it will display running build in Build History section as shown below:

Jenkins Project Dashboard

The blinking gray dot means that the build is on going. Click on that dot to see console output as shown below:

Jenkins Console Output

If something goes wrong then the dot color will turn to red and if everything is okay and build is successful then the dot color will turn blue. For the first time, it will take time to build as it might need to download required Gradle wrapper, platform tools, build tools, etc required files.

 

6. Archiving Artifacts(APKs)

So, you build your project successfully but what about the generated output (APK)? How can you get previous build result? Well, Jenkins provides a way to archive outputs of each build. Isn’t it good if you can find every APK that has ever built by Jenkins?

To archive build outputs, open Project dashboard and navigate to configure page and click on Post-build Actions tab. Under Post-build Actions section, click on Add post-build action button and select Archive the artifacts option.

Now we need to tell Jenkins, which files to archive. We want to archive APK that is generated as an output of the Grade build process. So we will provide path for that APK. By default, the APK is stored at the following path

<project-root>\app\build\outputs\apk\debug\

So will tell Jenkins to archive all the APK files in this directory. Now, the path already has context of workspace so don’t need to use ${workspace} variable. We can directly write relative path. It also supports wild cards.

Write output path as shown below:

Jenkins Archive the artifacts

click on Advance button and check Archive artifacts only if build is successful option. click on save and build project again. After your project is built successfully, navigate to project dashboard and select the last build from Build History section. on the build dashboard the archived artifact will be shown like this:

Jenkins Build Dashboard

Every successful build now on will have the artifacts archived. You can also download artifact by clicking on it.

Conclusion

There might be other methods to start with Jenkins and Android, but I found this as the best working way to get the ball rolling in a hassle-free manner. You might encounter access permission issue for both Windows and MacOs. But not to worry. Check those at first place and then proceed. Further, there are a few ways of doing the configuration (setting environment variables, configuring gradle, etc.), you can try other ways also that suits your goal.

Thanks for reading! If you liked the article, don’t forget to clap! Happy coding folks!

 

 

 

 

======================================================================

 

결과물을 슬랙에 업로드 하자

Execute shell
Command
#set LC_ALL=en_US.UTF-8
#set LANG=en_US.UTF-8
#set ANDROID_APP_KEYSTORE_PATH="C:/ProgramData/Jenkins/.jenkins/workspace/testApp/app/key/key.jks"

#export LC_ALL=en_US.UTF-8
#export LANG=en_US.UTF-8
#export ANDROID_APP_KEYSTORE_PATH="C:/ProgramData/Jenkins/.jenkins/workspace/testApp/app/key/key.jks"
#cd C:/ProgramData/Jenkins/.jenkins/workspace/testApp
#fastlane store
#bundle exec fastlane store
#clean build
#gradlew assemblePlaystoreRelease
 
Execute Windows batch command
Command
for /f "delims=" %%A in ('dir /b/s app\build\*.apk') do (set resultdd=%%A)
echo %resultdd%

for /f "delims=" %%A in ('dir /b/s app\build\*.apk') do (set nameapk=%%~nxA)
echo %nameapk%


curl https://slack.com/api/files.upload -F token="xoxb-you-token" -F channels="YOUCANNEL" -F title=%nameapk% -F filename=%nameapk% -F file=@%resultdd%

 

 

Invoke Gradle script
 Invoke Gradle
 Use Gradle Wrapper
 
∨ Make gradlew executable
Wrapper location
${workspace}

 

 

Tasks
assemblePlaystoreRelease

 

 

젠킨스 시작

 sudo /etc/init.d/jenkins start

 

 

 

 

터미널, cmd 에서 키 만들기

ssh-keygen

 

 

https://bitbucket.org/ 에서 키 추가

공개 키를 적용 [.pub]

https://bitbucket.org/{you repository}/{you repository}/admin/access-keys/ 

 

Bitbucket | The Git solution for professional teams

Collaborate on code with inline comments and pull requests. Manage and share your Git repositories to build and ship software, as a team.

bitbucket.org

 

젠킨스

bitbucket 플러그인 설치

Git Parameter Plug-In 설치

 

Git Parameter

Adds ability to choose branches, tags or revisions from git repositories configured in project.

plugins.jenkins.io

앱관리 ->

 

이 빌드는 매개변수가 있습니다 -> Git Parameter Plug-In 선택

Parameter Type -> branch or tag 선택

Default Value -> 기본 브랜치[origin/feature , origin/feature, origin/master 등등]

ex) origin/feature

 

소스 코드 관리 -> git -> git@bitbucket.org:{you repository}/{you project}.git

Branch Specifier (blank for 'any') -> 기본브랜치 설정 [*/feature , */origin , */master ]

ex) */feature

 

빌드 유발 -> Build when a change is pushed to BitBucket [체크]

 

Add Credentials

SSH -> 

Enter directly -> 

-----BEGIN OPENSSH PRIVATE KEY-----

sdsdsd....

-----END OPENSSH PRIVATE KEY-----

 

Passphrase : 암호

 

 

fastlane 설치

https://docs.fastlane.tools/getting-started/ios/setup/

 

Setup - fastlane docs

Getting started with fastlane for iOS Setup Xcode for fastlane xcode-select --install Installing fastlane fastlane can be installed in multiple ways. The preferred method is with Bundler. fastlane can also be installed directly through with Homebrew (if on

docs.fastlane.tools

 

-> 프로젝트에 fastlan 셋팅

 

앱설정 -> Build -> Shell executable -> fastlane 빌드 명령어 , ex)fastlane store

저장

gradlew 권한이 없다고 오류나는 경우있다.

 

Shell executable 에 아래 명령어 추가

chmod +x gradlew

 

ex)

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export ANDROID_APP_KEYSTORE_PATH="/var/lib/jenkins/workspace/app_test/app/key/keystore.jks"

chmod +x gradlew

fastlane store
bundle exec fastlane store

 

설치 환경

윈도우 10

WSL - 우분투 20 버전

 

 

 

 

wsl 파일 접근하기

\\wsl$

 

 

Install Jenkins

Here is the note about installing Jenkins on WSL that I collect from site list in reference,

Make an apt update, or JRE may download incomplete,

sudo apt update

Install Java Runtime Environment (JRE)

sudo apt install default-jdk default-jre

Right here, I will test if java installed by this

javac

Setup GPG keys of the Jenkins repository

wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -

Add Jenkins repository

sudo sh -c "echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list"

Make an apt update before installing, since you just add a new repository,

sudo apt update

Install Jenkins via apt

sudo apt install jenkins

 

[설치에 실패 하는 경우가 있다. 아래의 세 동작으로 해결하자.]

sudo apt install ca-certificates

sudo apt-get update

sudo apt install jenkins

 

Start Jenkins services by

sudo /etc/init.d/jenkins start

Launch Jenkins

Launch your browser and navigate to

http://{your_ip}:8080

Here you are, your personal Jenkins in WSL!!! At the first time you launch your Jenkins, you will need an initial admin password, just “more” this,

sudo more /var/lib/jenkins/secrets/initialAdminPassword

 

admin page 접속시 암호는 위의 명령어로 얻어 온다.

입장하여 기본 설치 진행후 아이디, 암호 설정 하면 끝

 

 

 

 

 

 

 

 

 

 

 

'IT' 카테고리의 다른 글

윈도우 젠킨스 설정  (0) 2022.02.24
젠킨스 + bitbucket + fastlane  (0) 2022.02.23
안드로이드 스튜디오 ssl 그래들 오류 해결방법?  (0) 2019.07.09
안드 스튜디오에서 ndk 빌드하기  (0) 2019.06.18
vlc 2.5.5 compile  (0) 2017.11.14

+ Recent posts